@@ -46,13 +46,12 @@ def no_match_list(self) -> List[str]:
46
46
47
47
def test_erroneous_substitution_pattern ():
48
48
with pytest .raises (ValueError ):
49
- regex = VirusRegex (substitution_pattern = "12345" )
49
+ _ = VirusRegex (substitution_pattern = "12345" )
50
50
51
51
52
52
def test_method_test ():
53
53
regex = VirusRegex ()
54
54
regex .test ()
55
- assert True
56
55
57
56
58
57
def test_match_method ():
@@ -94,7 +93,7 @@ def test_describe_method(capfd):
94
93
95
94
# Negative match on bug (group NEGATIVE_BUG) and ignore ladybug and corona virus
96
95
regex .describe ("The computer virus in the ladybug software caused a bug in the corona virus dashboard" )
97
- out , err = capfd .readouterr ()
96
+ out , _ = capfd .readouterr ()
98
97
assert "NEGATIVE_BUG" in out
99
98
assert "start" not in out
100
99
@@ -103,18 +102,18 @@ def test_describe_method(capfd):
103
102
"The computer virus in the ladybug software caused a bug in the corona virus dashboard" ,
104
103
position = True ,
105
104
)
106
- out , err = capfd .readouterr ()
105
+ out , _ = capfd .readouterr ()
107
106
assert "match result is : NEGATIVE" in out
108
107
assert "NEGATIVE_BUG" in out
109
108
assert "start" in out
110
109
111
110
regex .describe ("This is a dangerous virus" )
112
- out , err = capfd .readouterr ()
111
+ out , _ = capfd .readouterr ()
113
112
assert "match result is : POSITIVE" in out
114
113
assert "start" not in out
115
114
116
115
regex .describe ("Nada" )
117
- out , err = capfd .readouterr ()
116
+ out , _ = capfd .readouterr ()
118
117
assert "The input text did not match anything" in out
119
118
120
119
@@ -151,3 +150,45 @@ def no_match_list(self):
151
150
regex = SomeRegex ()
152
151
assert regex .neutral is None
153
152
assert regex .negative is None
153
+
154
+
155
+ class PairedMatchRegex (MelusineRegex ):
156
+ """
157
+ Test paired matching.
158
+ """
159
+
160
+ @property
161
+ def positive (self ) -> Union [str , Dict [str , str ]]:
162
+ return {
163
+ "test_1" : r"pos_pattern_1" ,
164
+ "test_2" : r"pos_pattern_2" ,
165
+ }
166
+
167
+ @property
168
+ def negative (self ) -> Optional [Union [str , Dict [str , str ]]]:
169
+ return {
170
+ "_test_1" : r"neg_pattern_1" ,
171
+ "generic" : r"neg_pattern_2" ,
172
+ }
173
+
174
+ @property
175
+ def match_list (self ) -> List [str ]:
176
+ return [
177
+ "Test pos_pattern_1" ,
178
+ "pos_pattern_2" ,
179
+ "pos_pattern_2 and neg_pattern_1" ,
180
+ ]
181
+
182
+ @property
183
+ def no_match_list (self ) -> List [str ]:
184
+ return [
185
+ "test" ,
186
+ "Test pos_pattern_1 and neg_pattern_1" ,
187
+ "pos_pattern_2 and neg_pattern_2" ,
188
+ "pos_pattern_1 and neg_pattern_2" ,
189
+ ]
190
+
191
+
192
+ def test_paired_matching_test ():
193
+ regex = PairedMatchRegex ()
194
+ regex .test ()
0 commit comments