@@ -171,6 +171,15 @@ def test_count(self):
171171
172172 def test_find (self ):
173173 string_tests .CommonTest .test_find (self )
174+ # test implementation details of the memchr fast path
175+ self .checkequal (100 , 'a' * 100 + '\u0102 ' , 'find' , '\u0102 ' )
176+ self .checkequal (- 1 , 'a' * 100 + '\u0102 ' , 'find' , '\u0201 ' )
177+ self .checkequal (- 1 , 'a' * 100 + '\u0102 ' , 'find' , '\u0120 ' )
178+ self .checkequal (- 1 , 'a' * 100 + '\u0102 ' , 'find' , '\u0220 ' )
179+ self .checkequal (100 , 'a' * 100 + '\U00100304 ' , 'find' , '\U00100304 ' )
180+ self .checkequal (- 1 , 'a' * 100 + '\U00100304 ' , 'find' , '\U00100204 ' )
181+ self .checkequal (- 1 , 'a' * 100 + '\U00100304 ' , 'find' , '\U00102004 ' )
182+ # check mixed argument types
174183 self .checkequalnofix (0 , 'abcdefghiabc' , 'find' , 'abc' )
175184 self .checkequalnofix (9 , 'abcdefghiabc' , 'find' , 'abc' , 1 )
176185 self .checkequalnofix (- 1 , 'abcdefghiabc' , 'find' , 'def' , 4 )
@@ -180,6 +189,14 @@ def test_find(self):
180189
181190 def test_rfind (self ):
182191 string_tests .CommonTest .test_rfind (self )
192+ # test implementation details of the memrchr fast path
193+ self .checkequal (0 , '\u0102 ' + 'a' * 100 , 'rfind' , '\u0102 ' )
194+ self .checkequal (- 1 , '\u0102 ' + 'a' * 100 , 'rfind' , '\u0201 ' )
195+ self .checkequal (- 1 , '\u0102 ' + 'a' * 100 , 'rfind' , '\u0120 ' )
196+ self .checkequal (- 1 , '\u0102 ' + 'a' * 100 , 'rfind' , '\u0220 ' )
197+ self .checkequal (0 , '\U00100304 ' + 'a' * 100 , 'rfind' , '\U00100304 ' )
198+ self .checkequal (- 1 , '\U00100304 ' + 'a' * 100 , 'rfind' , '\U00100204 ' )
199+ self .checkequal (- 1 , '\U00100304 ' + 'a' * 100 , 'rfind' , '\U00102004 ' )
183200 # check mixed argument types
184201 self .checkequalnofix (9 , 'abcdefghiabc' , 'rfind' , 'abc' )
185202 self .checkequalnofix (12 , 'abcdefghiabc' , 'rfind' , '' )
0 commit comments