def test_get_byte_n_n_too_small_raises(self): with self.assertRaises(IndexError): get_byte_n(b'123', -4)
def test_get_byte_n_n_too_large_raises(self): with self.assertRaises(IndexError): get_byte_n(b'123', 3)
def test_get_byte_n_nominal_case(self): b = b'123' self.assertEqual(b'3', get_byte_n(b, 2))
def test_get_byte_n_negative_indexing(self): b = b'123' self.assertEqual(b'3', get_byte_n(b, -1))
def test_get_byte_n_empty_bytes_raises(self): with self.assertRaises(IndexError): get_byte_n(b'', 0)