diff options
author | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-02 20:50:16 (GMT) |
---|---|---|
committer | Amaury Forgeot d'Arc <amauryfa@gmail.com> | 2008-07-02 20:50:16 (GMT) |
commit | e43d33a4db0c0c9afcb70a26f682abfe889e845b (patch) | |
tree | 47197bd06fa88bf96cef5f673018d20887fa301c /Lib/test/test_re.py | |
parent | 4118174315f4cba03208886af868fe31f1cd5b9d (diff) | |
download | cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.zip cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.gz cpython-e43d33a4db0c0c9afcb70a26f682abfe889e845b.tar.bz2 |
#3247 Get rid of Py_FindMethod; use tp_members instead.
Otherwise dir(_sre.SRE_Match) returns an empty list.
First step: handle most occurrences, remove tp_getattr and fill the tp_methods and tp_members slots.
Add some test about attribute access.
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 0b023c2..fd41b6e 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -326,6 +326,13 @@ class ReTests(unittest.TestCase): self.assertNotEqual(re.match("^x{}$", "x{}"), None) def test_getattr(self): + self.assertEqual(re.compile("(?i)(a)(b)").pattern, "(?i)(a)(b)") + self.assertEqual(re.compile("(?i)(a)(b)").flags, re.I) + self.assertEqual(re.compile("(?i)(a)(b)").groups, 2) + self.assertEqual(re.compile("(?i)(a)(b)").groupindex, {}) + self.assertEqual(re.compile("(?i)(?P<first>a)(?P<other>b)").groupindex, + {'first': 1, 'other': 2}) + self.assertEqual(re.match("(a)", "a").pos, 0) self.assertEqual(re.match("(a)", "a").endpos, 1) self.assertEqual(re.match("(a)", "a").string, "a") |