Beispiel #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")
Beispiel #2
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")
Beispiel #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")
Beispiel #4
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")
Beispiel #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')
Beispiel #6
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')