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")
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")
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')