Пример #1
0
def test_load_supercars_nojson():
    temp = tempfile.NamedTemporaryFile()
    try:
        temp.write('no json content')
        temp.seek(0)

        load_supercars(temp.name)
    finally:
        temp.close()
Пример #2
0
def test_load_supercars():
    temp = tempfile.NamedTemporaryFile()
    try:
        temp.write('[{"json": "true"}]')
        temp.seek(0)

        result = load_supercars(temp.name)
        assert_equal(result, {0: {'json': 'true'}})
    finally:
        temp.close()
Пример #3
0
def test_load_supercars_nosuchfile():
    load_supercars('nosuchfile.txt')