示例#1
0
def test_write():
    clear()

    assert not os.path.isfile(settings.DB)

    utils.write(fake_useragent_dict)

    assert os.path.isfile(settings.DB)
示例#2
0
def test_write():
    clear()

    assert not os.path.isfile(settings.DB)

    utils.write(fake_useragent_dict)

    assert os.path.isfile(settings.DB)
示例#3
0
def test_utils_write(path):
    data = {'foo': 'bar'}

    utils.write(path, data)

    with io.open(path, mode='rt', encoding='utf-8') as fp:
        expected = json.loads(fp.read())

    assert expected == data
示例#4
0
def test_utils_write(path):
    data = {'foo': 'bar'}

    utils.write(path, data)

    with io.open(path, mode='rt', encoding='utf-8') as fp:
        expected = json.loads(fp.read())

    assert expected == data