def test_with(self): t = MockFile("foo") with t.open('w') as b: b.write("bar") with t.open('r') as b: self.assertEquals(list(b), ['bar'])
def test_with(self): t = MockFile("foo") with t.open('w') as b: b.write("bar") with t.open('r') as b: self.assertEqual(list(b), ['bar'])
def test_unicode(self): t = MockFile("foo") with t.open('w') as b: b.write(u"bar") with t.open('r') as b: self.assertEqual(b.read(), u'bar')
def test_1(self): t = MockFile('test') p = t.open('w') print >> p, 'test' p.close() q = t.open('r') self.assertEqual(list(q), ['test\n']) q.close()
def test_1(self): t = MockFile("test") p = t.open("w") print >> p, "test" p.close() q = t.open("r") self.assertEqual(list(q), ["test\n"]) q.close()
def _touch(self, path): t = MockFile(path) with t.open('w'): pass