jayvdb / sre-tools

Consider decorating method with @staticmethod PYL-R0201
Performance
Major
2 years ago2 years old
Method doesn't use the class instance and could be converted into a static method
 9
10
11class TestCreateRegex(unittest.TestCase):
12    def test_clone_basic(self):13        orig = sre_parse.parse(r"a{2}")
14        new = clone_subpattern(orig)
15        sre_compile.compile(new)
Method doesn't use the class instance and could be converted into a static method
15        sre_compile.compile(new)
16        assert _val_eq(orig, new)
17
18    def test_create_basic(self):19        orig = sre_parse.parse(r"a{2}")
20        new = create_subpattern(orig.data)
21        sre_compile.compile(new)
Method doesn't use the class instance and could be converted into a static method
100
101        assert rv[1].data == [(sre_parse.LITERAL, ord("b"))]
102
103    def test_split_class(self):104        rv = split_regex(r"a[/]b", "/", remainer=True)
105        assert isinstance(rv, tuple), rv
106        assert isinstance(rv[0], sre_parse.SubPattern), rv
Method doesn't use the class instance and could be converted into a static method
108
109        assert rv[1].data == [(sre_parse.LITERAL, ord("b"))]
110
111    def test_split_class2(self):112        rv = split_regex(r"a[(/]b", "/", remainer=True)
113        assert isinstance(rv, tuple), rv
114        assert isinstance(rv[0], sre_parse.SubPattern), rv
Method doesn't use the class instance and could be converted into a static method
 92
 93        assert rv[1].data == [(sre_parse.LITERAL, ord("b"))]
 94
 95    def test_split_star(self): 96        rv = split_regex(r"a/*b", "/", remainer=True)
 97        assert isinstance(rv, tuple), rv
 98        assert isinstance(rv[0], sre_parse.SubPattern), rv