コード例 #1
0
ファイル: asm_to_inc_test.py プロジェクト: pkesist/buildpal
 def test_default(self):
     test_content = "some test content\n\nsome more test content"
     test_stream = io.StringIO()
     with _open_with_default(None, "w", test_stream) as f:
         f.write(test_content)
     assert not f.closed
     test_stream.seek(0, io.SEEK_SET)
     assert test_stream.read() == test_content
コード例 #2
0
ファイル: asm_to_inc_test.py プロジェクト: pkesist/buildpal
 def test_name_only__write(self, tmpdir):
     file = tmpdir.join("test.file")
     test_content = "some test content\n\nsome more test content"
     with _open_with_default(str(file), "w", None) as f:
         assert file.exists()
         assert not f.closed
         f.write(test_content)
     assert f.closed
     assert file.read() == test_content
コード例 #3
0
ファイル: asm_to_inc_test.py プロジェクト: pkesist/buildpal
 def test_name_and_default(self, tmpdir):
     file = tmpdir.join("test.file")
     test_content = "some test content\n\nsome more test content"
     test_stream = io.StringIO()
     with _open_with_default(str(file), "w", test_stream) as f:
         assert file.exists()
         assert not f.closed
         f.write(test_content)
     assert f.closed
     assert file.read() == test_content
     assert test_stream.tell() == 0
     assert not test_stream.read()