MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_re_findall

Method test_re_findall

Lib/test/test_re.py:478–502  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

476 re.split(":", ":a:b::c", 2, 0, 0)
477
478 def test_re_findall(self):
479 self.assertEqual(re.findall(":+", "abc"), [])
480 for string in "a:b::c:::d", S("a:b::c:::d"):
481 self.assertTypedEqual(re.findall(":+", string),
482 [":", "::", ":::"])
483 self.assertTypedEqual(re.findall("(:+)", string),
484 [":", "::", ":::"])
485 self.assertTypedEqual(re.findall("(:)(:*)", string),
486 [(":", ""), (":", ":"), (":", "::")])
487 for string in (b"a:b::c:::d", B(b"a:b::c:::d"), bytearray(b"a:b::c:::d"),
488 memoryview(b"a:b::c:::d")):
489 self.assertTypedEqual(re.findall(b":+", string),
490 [b":", b"::", b":::"])
491 self.assertTypedEqual(re.findall(b"(:+)", string),
492 [b":", b"::", b":::"])
493 self.assertTypedEqual(re.findall(b"(:)(:*)", string),
494 [(b":", b""), (b":", b":"), (b":", b"::")])
495 for x in ("\xe0", "\u0430", "\U0001d49c"):
496 xx = x * 2
497 xxx = x * 3
498 string = "a%sb%sc%sd" % (x, xx, xxx)
499 self.assertEqual(re.findall("%s+" % x, string), [x, xx, xxx])
500 self.assertEqual(re.findall("(%s+)" % x, string), [x, xx, xxx])
501 self.assertEqual(re.findall("(%s)(%s*)" % (x, x), string),
502 [(x, ""), (x, x), (x, xx)])
503
504 def test_bug_117612(self):
505 self.assertEqual(re.findall(r"(a|(b))", "aba"),

Callers

nothing calls this directly

Calls 5

assertTypedEqualMethod · 0.95
SClass · 0.70
BClass · 0.70
assertEqualMethod · 0.45
findallMethod · 0.45

Tested by

no test coverage detected