From da31de3294bea31f7f6beca8f7cc395fafd039a6 Mon Sep 17 00:00:00 2001 From: Jean Abou Samra Date: Mon, 13 Feb 2023 20:30:51 +0100 Subject: [PATCH] Remove "null" checker The Python documentation no longer states that regexes must not contain null characters starting with Python 3.6. --- regexlint/checkers.py | 9 --------- tests/test_checkers.py | 7 ------- 2 files changed, 16 deletions(-) diff --git a/regexlint/checkers.py b/regexlint/checkers.py index 1550d8e..a7754c1 100644 --- a/regexlint/checkers.py +++ b/regexlint/checkers.py @@ -38,15 +38,6 @@ ) -def check_no_nulls(reg, errs): - num = "101" - level = logging.ERROR - msg = "Null characters not allowed (python docs)" - pos = reg.raw.find("\x00") - if pos != -1: - errs.append((num, level, pos, msg)) - - def check_no_bels(reg, errs): num = "110" level = logging.ERROR diff --git a/tests/test_checkers.py b/tests/test_checkers.py index f0ae425..18057f9 100644 --- a/tests/test_checkers.py +++ b/tests/test_checkers.py @@ -36,7 +36,6 @@ check_no_consecutive_dots, check_no_empty_alternations, check_no_newlines, - check_no_nulls, check_prefix_ordering, check_redundant_repetition, check_single_character_classes, @@ -49,12 +48,6 @@ class CheckersTests(TestCase): - def test_null(self): - r = Regex.get_parse_tree("a\x00b") - errs = [] - check_no_nulls(r, errs) - self.assertEqual(len(errs), 1) - def test_newline(self): r = Regex.get_parse_tree("a\nb") errs = []