

def test_file_write(self):
    path = os.path.join(self.temp, 'afile')

    @modifiers.annotate(afile=converters.file(mode='w'))
    def func(afile):
        self.assertFalse(os.path.exists(path))
        with afile as f:
            self.assertEqual(f.name, path)
            self.assertEqual(f.mode, 'w')
        self.assertTrue(f.closed)
        self.assertTrue(os.path.exists(path))
    (o, e) = self.crun(func, ['test', path])
    self.assertFalse(o.getvalue())
    self.assertFalse(e.getvalue())

dataset/ETHPy150Open epsy/clize/clize/tests/test_converters.py FileConverterTests.test_file_write/original