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)
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')
def test_zero_position(self): window = BufferContentWindow(0, b'xyyy') self.assertEqual(window.get(1, 3), b'yyy')