예제 #1
0
 def test_invalid_sizes_or_offsets(self):
     window = BufferContentWindow(1, b'abcd')
     with self.assertRaises(AssertionError):
         window.get(1, 5)
     with self.assertRaises(AssertionError):
         window.get(0, 1)
     with self.assertRaises(AssertionError):
         window.get(5, 1)
예제 #2
0
 def test_nonzero_position(self):
     window = BufferContentWindow(1, b'abc')
     self.assertEqual(window.get(1, 3), b'abc')
     self.assertEqual(window.get(2, 2), b'bc')
예제 #3
0
 def test_zero_position(self):
     window = BufferContentWindow(0, b'xyyy')
     self.assertEqual(window.get(1, 3), b'yyy')