1 # -*- coding: utf-8 -*-
3 # This file is part of Librarian, licensed under GNU Affero GPLv3 or later.
4 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
7 from tempfile import NamedTemporaryFile
8 from nose.tools import *
9 from librarian import IOFile
12 def test_iofile_from_string_reusable():
13 some_file = IOFile.from_string("test")
14 some_file.get_file().read()
15 assert_equal(some_file.get_file().read(), "test")
18 def test_iofile_from_filename_reusable():
19 temp = NamedTemporaryFile(delete=False)
23 some_file = IOFile.from_filename(temp.name)
24 some_file.get_file().read()
25 assert_equal(some_file.get_file().read(), "test")