@@ -63,15 +63,15 @@ def test_should_match_anything(self):
63
63
)
64
64
65
65
def test_should_match_anything_but_specified_element_when_element_is_not_found (
66
- self
66
+ self
67
67
):
68
68
self .exp = (
69
69
self .v .start_of_line ().anything_but ("X" ).end_of_line ().regex ()
70
70
)
71
71
six .assertRegex (self , "Y Files" , self .exp , "Found the X!" )
72
72
73
73
def test_should_not_match_anything_but_specified_element_when_specified_element_is_found (
74
- self
74
+ self
75
75
):
76
76
self .exp = (
77
77
self .v .start_of_line ().anything_but ("X" ).end_of_line ().regex ()
@@ -89,20 +89,20 @@ def test_should_not_find_missing_element(self):
89
89
def test_should_match_when_maybe_element_is_present (self ):
90
90
self .exp = (
91
91
self .v .start_of_line ()
92
- .find ("Python2." )
93
- .maybe ("7" )
94
- .end_of_line ()
95
- .regex ()
92
+ .find ("Python2." )
93
+ .maybe ("7" )
94
+ .end_of_line ()
95
+ .regex ()
96
96
)
97
97
six .assertRegex (self , "Python2.7" , self .exp , "Version doesn't match!" )
98
98
99
99
def test_should_match_when_maybe_element_is_missing (self ):
100
100
self .exp = (
101
101
self .v .start_of_line ()
102
- .find ("Python2." )
103
- .maybe ("7" )
104
- .end_of_line ()
105
- .regex ()
102
+ .find ("Python2." )
103
+ .maybe ("7" )
104
+ .end_of_line ()
105
+ .regex ()
106
106
)
107
107
six .assertRegex (self , "Python2." , self .exp , "Version doesn't match!" )
108
108
@@ -121,33 +121,33 @@ def test_should_not_match_on_any_when_element_is_not_found(self):
121
121
def test_should_match_when_line_break_present (self ):
122
122
self .exp = (
123
123
self .v .start_of_line ()
124
- .anything ()
125
- .line_break ()
126
- .anything ()
127
- .end_of_line ()
128
- .regex ()
124
+ .anything ()
125
+ .line_break ()
126
+ .anything ()
127
+ .end_of_line ()
128
+ .regex ()
129
129
)
130
130
six .assertRegex (self , "Marco \n Polo" , self .exp , "Give me a break!!" )
131
131
132
132
def test_should_match_when_line_break_and_carriage_return_present (self ):
133
133
self .exp = (
134
134
self .v .start_of_line ()
135
- .anything ()
136
- .line_break ()
137
- .anything ()
138
- .end_of_line ()
139
- .regex ()
135
+ .anything ()
136
+ .line_break ()
137
+ .anything ()
138
+ .end_of_line ()
139
+ .regex ()
140
140
)
141
141
six .assertRegex (self , "Marco \r \n Polo" , self .exp , "Give me a break!!" )
142
142
143
143
def test_should_not_match_when_line_break_is_missing (self ):
144
144
self .exp = (
145
145
self .v .start_of_line ()
146
- .anything ()
147
- .line_break ()
148
- .anything ()
149
- .end_of_line ()
150
- .regex ()
146
+ .anything ()
147
+ .line_break ()
148
+ .anything ()
149
+ .end_of_line ()
150
+ .regex ()
151
151
)
152
152
self .assertNotRegexpMatches (
153
153
"Marco Polo" , self .exp , "There's a break here!"
@@ -184,48 +184,48 @@ def test_not_match_when_two_words_are_present_instead_of_one(self):
184
184
def test_should_match_when_or_condition_fulfilled (self ):
185
185
self .exp = (
186
186
self .v .start_of_line ()
187
- .anything ()
188
- .find ("G" )
189
- .OR ()
190
- .find ("h" )
191
- .end_of_line ()
192
- .regex ()
187
+ .anything ()
188
+ .find ("G" )
189
+ .OR ()
190
+ .find ("h" )
191
+ .end_of_line ()
192
+ .regex ()
193
193
)
194
194
six .assertRegex (self , "Github" , self .exp , "Octocat not found" )
195
195
196
196
def test_should_not_match_when_or_condition_not_fulfilled (self ):
197
197
self .exp = (
198
198
self .v .start_of_line ()
199
- .anything ()
200
- .find ("G" )
201
- .OR ()
202
- .find ("h" )
203
- .end_of_line ()
204
- .regex ()
199
+ .anything ()
200
+ .find ("G" )
201
+ .OR ()
202
+ .find ("h" )
203
+ .end_of_line ()
204
+ .regex ()
205
205
)
206
206
self .assertFalse (re .match (self .exp , "Bitbucket" ), "Bucket not found" )
207
207
208
208
def test_should_match_on_upper_case_when_lower_case_is_given_and_any_case_is_true (
209
- self
209
+ self
210
210
):
211
211
self .exp = (
212
212
self .v .start_of_line ()
213
- .find ("THOR" )
214
- .end_of_line ()
215
- .with_any_case (True )
216
- .regex ()
213
+ .find ("THOR" )
214
+ .end_of_line ()
215
+ .with_any_case (True )
216
+ .regex ()
217
217
)
218
218
six .assertRegex (self , "thor" , self .exp , "Upper case Thor, please!" )
219
219
220
220
def test_should_match_multiple_lines (self ):
221
221
self .exp = (
222
222
self .v .start_of_line ()
223
- .anything ()
224
- .find ("Pong" )
225
- .anything ()
226
- .end_of_line ()
227
- .search_one_line (True )
228
- .regex ()
223
+ .anything ()
224
+ .find ("Pong" )
225
+ .anything ()
226
+ .end_of_line ()
227
+ .search_one_line (True )
228
+ .regex ()
229
229
)
230
230
six .assertRegex (
231
231
self , "Ping \n Pong \n Ping" , self .exp , "Pong didn't answer"
@@ -234,29 +234,29 @@ def test_should_match_multiple_lines(self):
234
234
def test_should_match_email_address (self ):
235
235
self .exp = (
236
236
self .v .start_of_line ()
237
- .word ()
238
- .then ("@" )
239
- .word ()
240
- .then ("." )
241
- .word ()
242
- .end_of_line ()
243
- .regex ()
237
+ .word ()
238
+ .then ("@" )
239
+ .word ()
240
+ .then ("." )
241
+ .word ()
242
+ .end_of_line ()
243
+ .regex ()
244
244
)
245
245
six .
assertRegex (
self ,
"[email protected] " ,
self .
exp ,
"Not a valid email" )
246
246
247
247
def test_should_match_url (self ):
248
248
self .exp = (
249
249
self .v .start_of_line ()
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 ()
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 ()
260
260
)
261
261
six .assertRegex (
262
262
self , "https://www.google.com/" , self .exp , "Not a valid email"
0 commit comments