1+ # -*- encoding: utf-8 -*-
2+
13import unittest
24import re
35
@@ -61,15 +63,15 @@ def test_should_match_anything(self):
6163 )
6264
6365 def test_should_match_anything_but_specified_element_when_element_is_not_found (
64- self
66+ self
6567 ):
6668 self .exp = (
6769 self .v .start_of_line ().anything_but ("X" ).end_of_line ().regex ()
6870 )
6971 six .assertRegex (self , "Y Files" , self .exp , "Found the X!" )
7072
7173 def test_should_not_match_anything_but_specified_element_when_specified_element_is_found (
72- self
74+ self
7375 ):
7476 self .exp = (
7577 self .v .start_of_line ().anything_but ("X" ).end_of_line ().regex ()
@@ -87,20 +89,20 @@ def test_should_not_find_missing_element(self):
8789 def test_should_match_when_maybe_element_is_present (self ):
8890 self .exp = (
8991 self .v .start_of_line ()
90- .find ("Python2." )
91- .maybe ("7" )
92- .end_of_line ()
93- .regex ()
92+ .find ("Python2." )
93+ .maybe ("7" )
94+ .end_of_line ()
95+ .regex ()
9496 )
9597 six .assertRegex (self , "Python2.7" , self .exp , "Version doesn't match!" )
9698
9799 def test_should_match_when_maybe_element_is_missing (self ):
98100 self .exp = (
99101 self .v .start_of_line ()
100- .find ("Python2." )
101- .maybe ("7" )
102- .end_of_line ()
103- .regex ()
102+ .find ("Python2." )
103+ .maybe ("7" )
104+ .end_of_line ()
105+ .regex ()
104106 )
105107 six .assertRegex (self , "Python2." , self .exp , "Version doesn't match!" )
106108
@@ -119,33 +121,33 @@ def test_should_not_match_on_any_when_element_is_not_found(self):
119121 def test_should_match_when_line_break_present (self ):
120122 self .exp = (
121123 self .v .start_of_line ()
122- .anything ()
123- .line_break ()
124- .anything ()
125- .end_of_line ()
126- .regex ()
124+ .anything ()
125+ .line_break ()
126+ .anything ()
127+ .end_of_line ()
128+ .regex ()
127129 )
128130 six .assertRegex (self , "Marco \n Polo" , self .exp , "Give me a break!!" )
129131
130132 def test_should_match_when_line_break_and_carriage_return_present (self ):
131133 self .exp = (
132134 self .v .start_of_line ()
133- .anything ()
134- .line_break ()
135- .anything ()
136- .end_of_line ()
137- .regex ()
135+ .anything ()
136+ .line_break ()
137+ .anything ()
138+ .end_of_line ()
139+ .regex ()
138140 )
139141 six .assertRegex (self , "Marco \r \n Polo" , self .exp , "Give me a break!!" )
140142
141143 def test_should_not_match_when_line_break_is_missing (self ):
142144 self .exp = (
143145 self .v .start_of_line ()
144- .anything ()
145- .line_break ()
146- .anything ()
147- .end_of_line ()
148- .regex ()
146+ .anything ()
147+ .line_break ()
148+ .anything ()
149+ .end_of_line ()
150+ .regex ()
149151 )
150152 self .assertNotRegexpMatches (
151153 "Marco Polo" , self .exp , "There's a break here!"
@@ -182,48 +184,48 @@ def test_not_match_when_two_words_are_present_instead_of_one(self):
182184 def test_should_match_when_or_condition_fulfilled (self ):
183185 self .exp = (
184186 self .v .start_of_line ()
185- .anything ()
186- .find ("G" )
187- .OR ()
188- .find ("h" )
189- .end_of_line ()
190- .regex ()
187+ .anything ()
188+ .find ("G" )
189+ .OR ()
190+ .find ("h" )
191+ .end_of_line ()
192+ .regex ()
191193 )
192194 six .assertRegex (self , "Github" , self .exp , "Octocat not found" )
193195
194196 def test_should_not_match_when_or_condition_not_fulfilled (self ):
195197 self .exp = (
196198 self .v .start_of_line ()
197- .anything ()
198- .find ("G" )
199- .OR ()
200- .find ("h" )
201- .end_of_line ()
202- .regex ()
199+ .anything ()
200+ .find ("G" )
201+ .OR ()
202+ .find ("h" )
203+ .end_of_line ()
204+ .regex ()
203205 )
204206 self .assertFalse (re .match (self .exp , "Bitbucket" ), "Bucket not found" )
205207
206208 def test_should_match_on_upper_case_when_lower_case_is_given_and_any_case_is_true (
207- self
209+ self
208210 ):
209211 self .exp = (
210212 self .v .start_of_line ()
211- .find ("THOR" )
212- .end_of_line ()
213- .with_any_case (True )
214- .regex ()
213+ .find ("THOR" )
214+ .end_of_line ()
215+ .with_any_case (True )
216+ .regex ()
215217 )
216218 six .assertRegex (self , "thor" , self .exp , "Upper case Thor, please!" )
217219
218220 def test_should_match_multiple_lines (self ):
219221 self .exp = (
220222 self .v .start_of_line ()
221- .anything ()
222- .find ("Pong" )
223- .anything ()
224- .end_of_line ()
225- .search_one_line (True )
226- .regex ()
223+ .anything ()
224+ .find ("Pong" )
225+ .anything ()
226+ .end_of_line ()
227+ .search_one_line (True )
228+ .regex ()
227229 )
228230 six .assertRegex (
229231 self , "Ping \n Pong \n Ping" , self .exp , "Pong didn't answer"
@@ -232,29 +234,29 @@ def test_should_match_multiple_lines(self):
232234 def test_should_match_email_address (self ):
233235 self .exp = (
234236 self .v .start_of_line ()
235- .word ()
236- .then ("@" )
237- .word ()
238- .then ("." )
239- .word ()
240- .end_of_line ()
241- .regex ()
237+ .word ()
238+ .then ("@" )
239+ .word ()
240+ .then ("." )
241+ .word ()
242+ .end_of_line ()
243+ .regex ()
242244 )
243245 six .assertRegex (self , "mail@mail.com" , self .exp , "Not a valid email" )
244246
245247 def test_should_match_url (self ):
246248 self .exp = (
247249 self .v .start_of_line ()
248- .then ("http" )
249- .maybe ("s" )
250- .then ("://" )
251- .maybe ("www." )
252- .word ()
253- .then ("." )
254- .word ()
255- .maybe ("/" )
256- .end_of_line ()
257- .regex ()
250+ .then ("http" )
251+ .maybe ("s" )
252+ .then ("://" )
253+ .maybe ("www." )
254+ .word ()
255+ .then ("." )
256+ .word ()
257+ .maybe ("/" )
258+ .end_of_line ()
259+ .regex ()
258260 )
259261 six .assertRegex (
260262 self , "https://www.google.com/" , self .exp , "Not a valid email"
0 commit comments