File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -825,6 +825,16 @@ def test_search_dot_unicode(self):
825825 self .assertIsNotNone (re .search ("123.*-" , '123\U0010ffff -' ))
826826 self .assertIsNotNone (re .search ("123.*-" , '123\xe9 \u20ac \U0010ffff -' ))
827827
828+ def test_compile (self ):
829+ # Test return value when given string and pattern as parameter
830+ pattern = re .compile ('random pattern' )
831+ self .assertIsInstance (pattern , re ._pattern_type )
832+ same_pattern = re .compile (pattern )
833+ self .assertIsInstance (same_pattern , re ._pattern_type )
834+ self .assertIs (same_pattern , pattern )
835+ # Test behaviour when not given a string or pattern as parameter
836+ self .assertRaises (TypeError , re .compile , 0 )
837+
828838def run_re_tests ():
829839 from test .re_tests import tests , SUCCEED , FAIL , SYNTAX_ERROR
830840 if verbose :
Original file line number Diff line number Diff line change @@ -687,6 +687,7 @@ Andrii V. Mishkovskyi
687687Dom Mitchell
688688Dustin J. Mitchell
689689Zubin Mithra
690+ Florian Mladitsch
690691Doug Moen
691692The Dragon De Monsyne
692693Skip Montanaro
You can’t perform that action at this time.
0 commit comments