示例#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')