diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-04-16 07:16:03 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-16 07:16:03 (GMT) |
commit | fdbd01151dbd5feea3e4c0316d102db3d2a2a412 (patch) | |
tree | eba32283c798704a241b13119cbbc74c1da3e069 /Lib/test/test_re.py | |
parent | cd85d0b90b39310c8ca7329bd35e82c2c1c8f4ad (diff) | |
download | cpython-fdbd01151dbd5feea3e4c0316d102db3d2a2a412.zip cpython-fdbd01151dbd5feea3e4c0316d102db3d2a2a412.tar.gz cpython-fdbd01151dbd5feea3e4c0316d102db3d2a2a412.tar.bz2 |
bpo-10076: Compiled regular expression and match objects now are copyable. (#1000)
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r-- | Lib/test/test_re.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index b3b29f8..da5c953 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -971,6 +971,15 @@ class ReTests(unittest.TestCase): # current pickle expects the _compile() reconstructor in re module from re import _compile + def test_copying(self): + import copy + p = re.compile(r'(?P<int>\d+)(?:\.(?P<frac>\d*))?') + self.assertIs(copy.copy(p), p) + self.assertIs(copy.deepcopy(p), p) + m = p.match('12.34') + self.assertIs(copy.copy(m), m) + self.assertIs(copy.deepcopy(m), m) + def test_constants(self): self.assertEqual(re.I, re.IGNORECASE) self.assertEqual(re.L, re.LOCALE) |