async def remove_filters(self, *filter_ids): for filter_id in filter_ids: if not validate_hex_string("0x" + filter_id): raise JsonRPCInvalidParamsError(data={ 'id': 'bad_arguments', 'message': 'Bad Arguments' }) await self.request_handler.remove_filters(filter_ids) return True
def test_validate_hex_string(self): self.assertTrue(utils.validate_hex_string("0x1")) self.assertTrue(utils.validate_hex_string(u"0x1")) self.assertTrue(utils.validate_hex_string("0xA")) self.assertTrue(utils.validate_hex_string("0xABCDEF")) self.assertFalse(utils.validate_hex_string("0xHIJKL")) self.assertFalse(utils.validate_hex_string(12345)) self.assertFalse(utils.validate_hex_string(0xABC)) self.assertFalse(utils.validate_hex_string(None)) self.assertFalse(utils.validate_hex_string({})) self.assertFalse(utils.validate_hex_string("ABCDEF")) self.assertFalse(utils.validate_hex_string("0x"))