11import pytest
22
33from oida .checkers import Code , ComponentIsolationChecker , Violation
4- from oida .utils import parse_noqa_comment
4+ from oida .utils import parse_noida_comment
55
66pytestmark = pytest .mark .module (name = "selectors" , module = "project.component.app" )
77
88
9- def test_parse_noqa_comment_no_comment () -> None :
10- """Test parsing line without noqa comment"""
11- assert parse_noqa_comment ("x = 1" ) is None
12- assert parse_noqa_comment ("from foo import bar" ) is None
9+ def test_parse_noida_comment_no_comment () -> None :
10+ """Test parsing line without noida comment"""
11+ assert parse_noida_comment ("x = 1" ) is None
12+ assert parse_noida_comment ("from foo import bar" ) is None
1313
1414
15- def test_parse_noqa_comment_generic () -> None :
16- """Test parsing generic noqa comment"""
17- assert parse_noqa_comment ("x = 1 # noqa " ) == set ()
18- assert parse_noqa_comment ("x = 1 #noqa " ) == set ()
19- assert parse_noqa_comment ("x = 1 # NOQA " ) == set ()
15+ def test_parse_noida_comment_generic () -> None :
16+ """Test parsing generic noida comment"""
17+ assert parse_noida_comment ("x = 1 # noida " ) == set ()
18+ assert parse_noida_comment ("x = 1 #noida " ) == set ()
19+ assert parse_noida_comment ("x = 1 # NOIDA " ) == set ()
2020
2121
22- def test_parse_noqa_comment_specific_code () -> None :
23- """Test parsing noqa comment with specific code"""
24- assert parse_noqa_comment ("x = 1 # noqa : ODA005" ) == {"ODA005" }
25- assert parse_noqa_comment ("x = 1 # noqa :ODA005" ) == {"ODA005" }
26- assert parse_noqa_comment ("x = 1 # NOQA : ODA005" ) == {"ODA005" }
22+ def test_parse_noida_comment_specific_code () -> None :
23+ """Test parsing noida comment with specific code"""
24+ assert parse_noida_comment ("x = 1 # noida : ODA005" ) == {"ODA005" }
25+ assert parse_noida_comment ("x = 1 # noida :ODA005" ) == {"ODA005" }
26+ assert parse_noida_comment ("x = 1 # NOIDA : ODA005" ) == {"ODA005" }
2727
2828
29- def test_parse_noqa_comment_multiple_codes () -> None :
30- """Test parsing noqa comment with multiple codes"""
31- assert parse_noqa_comment ("x = 1 # noqa : ODA005, ODA001" ) == {"ODA005" , "ODA001" }
32- assert parse_noqa_comment ("x = 1 # noqa : ODA005,ODA001" ) == {"ODA005" , "ODA001" }
33- assert parse_noqa_comment ("x = 1 # noqa : ODA005 , ODA001" ) == {
29+ def test_parse_noida_comment_multiple_codes () -> None :
30+ """Test parsing noida comment with multiple codes"""
31+ assert parse_noida_comment ("x = 1 # noida : ODA005, ODA001" ) == {"ODA005" , "ODA001" }
32+ assert parse_noida_comment ("x = 1 # noida : ODA005,ODA001" ) == {"ODA005" , "ODA001" }
33+ assert parse_noida_comment ("x = 1 # noida : ODA005 , ODA001" ) == {
3434 "ODA005" ,
3535 "ODA001" ,
3636 }
@@ -39,41 +39,41 @@ def test_parse_noqa_comment_multiple_codes() -> None:
3939@pytest .mark .module (
4040 """\
4141 from project.other.app.services import service
42- service() # noqa
42+ service() # noida
4343 """
4444)
45- def test_noqa_generic_ignores_violation (
45+ def test_noida_generic_ignores_violation (
4646 checker : ComponentIsolationChecker , violations : list [Violation ]
4747) -> None :
48- """Test that generic noqa comment ignores all violations on that line"""
48+ """Test that generic noida comment ignores all violations on that line"""
4949 assert violations == []
5050 assert checker .referenced_imports == {"project.other.app.services.service" }
5151
5252
5353@pytest .mark .module (
5454 """\
5555 from project.other.app.services import service
56- service() # noqa : ODA005
56+ service() # noida : ODA005
5757 """
5858)
59- def test_noqa_specific_code_ignores_violation (
59+ def test_noida_specific_code_ignores_violation (
6060 checker : ComponentIsolationChecker , violations : list [Violation ]
6161) -> None :
62- """Test that specific noqa comment ignores matching violation"""
62+ """Test that specific noida comment ignores matching violation"""
6363 assert violations == []
6464 assert checker .referenced_imports == {"project.other.app.services.service" }
6565
6666
6767@pytest .mark .module (
6868 """\
6969 from project.other.app.services import service
70- service() # noqa : ODA001
70+ service() # noida : ODA001
7171 """
7272)
73- def test_noqa_different_code_does_not_ignore (
73+ def test_noida_different_code_does_not_ignore (
7474 checker : ComponentIsolationChecker , violations : list [Violation ]
7575) -> None :
76- """Test that noqa comment with different code does not ignore violation"""
76+ """Test that noida comment with different code does not ignore violation"""
7777 assert violations == [
7878 Violation (
7979 line = 2 ,
@@ -88,13 +88,13 @@ def test_noqa_different_code_does_not_ignore(
8888@pytest .mark .module (
8989 """\
9090 from project.other.app.services import service
91- service() # noqa : ODA005, ODA001
91+ service() # noida : ODA005, ODA001
9292 """
9393)
94- def test_noqa_multiple_codes_ignores_matching (
94+ def test_noida_multiple_codes_ignores_matching (
9595 checker : ComponentIsolationChecker , violations : list [Violation ]
9696) -> None :
97- """Test that noqa comment with multiple codes ignores matching violation"""
97+ """Test that noida comment with multiple codes ignores matching violation"""
9898 assert violations == []
9999 assert checker .referenced_imports == {"project.other.app.services.service" }
100100
@@ -104,13 +104,13 @@ def test_noqa_multiple_codes_ignores_matching(
104104 from project.other.app.models import Model
105105
106106 def selector() -> None:
107- Model.objects.get() # noqa : ODA005
107+ Model.objects.get() # noida : ODA005
108108 """
109109)
110- def test_noqa_in_function_body (
110+ def test_noida_in_function_body (
111111 checker : ComponentIsolationChecker , violations : list [Violation ]
112112) -> None :
113- """Test that noqa comment works in function bodies"""
113+ """Test that noida comment works in function bodies"""
114114 assert violations == []
115115 assert checker .referenced_imports == {"project.other.app.models.Model" }
116116
@@ -121,13 +121,13 @@ def test_noqa_in_function_body(
121121
122122 def selector() -> None:
123123 Model.objects.get()
124- Model.objects.filter() # noqa
124+ Model.objects.filter() # noida
125125 """
126126)
127- def test_noqa_only_affects_its_line (
127+ def test_noida_only_affects_its_line (
128128 checker : ComponentIsolationChecker , violations : list [Violation ]
129129) -> None :
130- """Test that noqa comment only affects violations on its own line"""
130+ """Test that noida comment only affects violations on its own line"""
131131 assert violations == [
132132 Violation (
133133 line = 4 ,
0 commit comments