Esempio n. 1
0
 def test_dest(self):
     dest = Dest(self.tmppath("dest"))
     self.assertFalse(dest.exists())
     dest.write(b"foo")
     self.assertTrue(dest.exists())
     dest.write(b"foo")
     self.assertEqual(dest.read(4), b"foof")
     self.assertEqual(dest.read(), b"oo")
     self.assertEqual(dest.read(), b"")
     dest.write(b"bar")
     self.assertEqual(dest.read(4), b"bar")
     dest.close()
     self.assertEqual(dest.read(), b"bar")
     dest.write(b"foo")
     dest.close()
     dest.write(b"qux")
     self.assertEqual(dest.read(), b"qux")
Esempio n. 2
0
 def test_dest(self):
     dest = Dest(self.tmppath('dest'))
     self.assertFalse(dest.exists())
     dest.write('foo')
     self.assertTrue(dest.exists())
     dest.write('foo')
     self.assertEqual(dest.read(4), 'foof')
     self.assertEqual(dest.read(), 'oo')
     self.assertEqual(dest.read(), '')
     dest.write('bar')
     self.assertEqual(dest.read(4), 'bar')
     dest.close()
     self.assertEqual(dest.read(), 'bar')
     dest.write('foo')
     dest.close()
     dest.write('qux')
     self.assertEqual(dest.read(), 'qux')
Esempio n. 3
0
 def test_dest(self):
     dest = Dest(self.tmppath('dest'))
     self.assertFalse(dest.exists())
     dest.write('foo')
     self.assertTrue(dest.exists())
     dest.write('foo')
     self.assertEqual(dest.read(4), 'foof')
     self.assertEqual(dest.read(), 'oo')
     self.assertEqual(dest.read(), '')
     dest.write('bar')
     self.assertEqual(dest.read(4), 'bar')
     dest.close()
     self.assertEqual(dest.read(), 'bar')
     dest.write('foo')
     dest.close()
     dest.write('qux')
     self.assertEqual(dest.read(), 'qux')
Esempio n. 4
0
 def test_dest(self):
     dest = Dest(self.tmppath("dest"))
     self.assertFalse(dest.exists())
     dest.write("foo")
     self.assertTrue(dest.exists())
     dest.write("foo")
     self.assertEqual(dest.read(4), "foof")
     self.assertEqual(dest.read(), "oo")
     self.assertEqual(dest.read(), "")
     dest.write("bar")
     self.assertEqual(dest.read(4), "bar")
     dest.close()
     self.assertEqual(dest.read(), "bar")
     dest.write("foo")
     dest.close()
     dest.write("qux")
     self.assertEqual(dest.read(), "qux")