(self)
| 276 | self.assertEqual(translated, expect, pattern) |
| 277 | |
| 278 | def test_translate_expressions(self): |
| 279 | for pattern, expect in [ |
| 280 | ('[', r'(?s:\[)\z'), |
| 281 | ('[!', r'(?s:\[!)\z'), |
| 282 | ('[]', r'(?s:\[\])\z'), |
| 283 | ('[abc', r'(?s:\[abc)\z'), |
| 284 | ('[!abc', r'(?s:\[!abc)\z'), |
| 285 | ('[abc]', r'(?s:[abc])\z'), |
| 286 | ('[!abc]', r'(?s:[^abc])\z'), |
| 287 | ('[!abc][!def]', r'(?s:[^abc][^def])\z'), |
| 288 | # with [[ |
| 289 | ('[[', r'(?s:\[\[)\z'), |
| 290 | ('[[a', r'(?s:\[\[a)\z'), |
| 291 | ('[[]', r'(?s:[\[])\z'), |
| 292 | ('[[]a', r'(?s:[\[]a)\z'), |
| 293 | ('[[]]', r'(?s:[\[]\])\z'), |
| 294 | ('[[]a]', r'(?s:[\[]a\])\z'), |
| 295 | ('[[a]', r'(?s:[\[a])\z'), |
| 296 | ('[[a]]', r'(?s:[\[a]\])\z'), |
| 297 | ('[[a]b', r'(?s:[\[a]b)\z'), |
| 298 | # backslashes |
| 299 | ('[\\', r'(?s:\[\\)\z'), |
| 300 | (r'[\]', r'(?s:[\\])\z'), |
| 301 | (r'[\\]', r'(?s:[\\\\])\z'), |
| 302 | ]: |
| 303 | with self.subTest(pattern): |
| 304 | translated = translate(pattern) |
| 305 | self.assertEqual(translated, expect, pattern) |
| 306 | |
| 307 | def test_star_indices_locations(self): |
| 308 | from fnmatch import _translate |
nothing calls this directly
no test coverage detected