File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -743,14 +743,14 @@ def test_bson_regex(self):
743743 self .assertEqual (doc1 , BSON (doc1_bson ).decode (compile_re = False ))
744744
745745 # Valid Python regex, with flags.
746- re2 = re .compile ('.*' , re .I | re . L | re .M | re .S | re .U | re .X )
747- bson_re2 = Regex ('.*' , re .I | re . L | re .M | re .S | re .U | re .X )
746+ re2 = re .compile (unicode ( '.*' ) , re .I | re .M | re .S | re .U | re .X )
747+ bson_re2 = Regex (unicode ( '.*' ) , re .I | re .M | re .S | re .U | re .X )
748748
749749 doc2_with_re = {'r' : re2 }
750750 doc2_with_bson_re = {'r' : bson_re2 }
751751 doc2_bson = b (
752- "\x12 \x00 \x00 \x00 " # document length
753- "\x0b r\x00 .*\x00 ilmsux \x00 " # r: regex
752+ "\x11 \x00 \x00 \x00 " # document length
753+ "\x0b r\x00 .*\x00 imsux \x00 " # r: regex
754754 "\x00 " ) # document terminator
755755
756756 self .assertEqual (doc2_bson , BSON .encode (doc2_with_re ))
Original file line number Diff line number Diff line change @@ -146,10 +146,10 @@ def test_regex(self):
146146 else :
147147 self .assertEqual (re .IGNORECASE , res .flags )
148148
149- all_options = re .I | re . L | re .M | re .S | re .U | re .X
150- regex = re .compile ("a*b" , all_options )
149+ unicode_options = re .I | re .M | re .S | re .U | re .X
150+ regex = re .compile ("a*b" , unicode_options )
151151 res = self .round_tripped ({"r" : regex })["r" ]
152- self .assertEqual (all_options , res .flags )
152+ self .assertEqual (unicode_options , res .flags )
153153
154154 # Some tools may not add $options if no flags are set.
155155 res = json_util .loads ('{"r": {"$regex": "a*b"}}' )['r' ]
You can’t perform that action at this time.
0 commit comments