def test_hexstr2bytes(self): test1 = '0x41424344' test1_res = b'ABCD' self.assertEqual(hexstr2bytes(test1), test1_res) test2 = '41424344' self.assertRaises(BytesWarning, hexstr2bytes, test2)