コード例 #1
0
 def test_read(self):
     with open(self.filename, 'w') as pyfile:
         pyfile.write('hello')
     with open(self.filename, 'r') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, "r")
         val = test_py3c.file_fread(f)
         self.assertEqual(val, "hello")
コード例 #2
0
ファイル: __main__.py プロジェクト: eye3/py3c
 def test_read(self):
     with open(self.filename, 'w') as pyfile:
         pyfile.write('hello')
     with open(self.filename, 'r') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, "r")
         val = test_py3c.file_fread(f)
         self.assertEqual(val, "hello")
コード例 #3
0
 def test_read_write(self):
     with open(self.filename, 'w') as pyfile:
         pass
     with open(self.filename, 'w+') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, 'w+')
         test_py3c.file_fwrite(f, "hello")
         test_py3c.file_fseek(f, 0)
         val = test_py3c.file_fread(f)
         self.assertEqual(val, "hello")
コード例 #4
0
ファイル: __main__.py プロジェクト: eye3/py3c
 def test_read_write(self):
     with open(self.filename, 'w') as pyfile:
         pass
     with open(self.filename, 'w+') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, 'w+')
         test_py3c.file_fwrite(f, "hello")
         test_py3c.file_fseek(f, 0)
         val = test_py3c.file_fread(f)
         self.assertEqual(val, "hello")
コード例 #5
0
 def test_write(self):
     with open(self.filename, 'w') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, "w")
         test_py3c.file_fwrite(f, "hello")
     with open(self.filename, 'r') as pyfile:
         self.assertEqual(pyfile.read(), 'hello')
コード例 #6
0
ファイル: __main__.py プロジェクト: eye3/py3c
 def test_write(self):
     with open(self.filename, 'w') as pyfile:
         f = test_py3c.file_asfilewithmode(pyfile, "w")
         test_py3c.file_fwrite(f, "hello")
     with open(self.filename, 'r') as pyfile:
         self.assertEqual(pyfile.read(), 'hello')