Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(119515)

Unified Diff: Lib/test/test_re.py

Issue 10076: Regex objects became uncopyable in 2.5
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Misc/NEWS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Lib/test/test_re.py
===================================================================
--- Lib/test/test_re.py (revision 85383)
+++ Lib/test/test_re.py (working copy)
@@ -1,4 +1,5 @@
from test.test_support import verbose, run_unittest, import_module
+import copy
import re
from re import Scanner
import sys, traceback
@@ -711,6 +712,14 @@
self.assertRaises(TypeError, re.finditer, "a", {})
self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
+ def test_copy(self):
+ pattern1 = re.compile('a.c')
+ self.assertTrue(pattern1.match('abc'))
+ pattern2 = copy.copy(pattern1)
+ self.assertTrue(pattern2.match('abc'))
+ pattern3 = copy.deepcopy(pattern1)
+ self.assertTrue(pattern3.match('abc'))
+
def run_re_tests():
from test.re_tests import tests, SUCCEED, FAIL, SYNTAX_ERROR
if verbose:
« no previous file with comments | « no previous file | Misc/NEWS » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+