def test_findstrregex(self): self.assertEqual(self._q(query.find_str_regex("ABC", "A")), [{ "start": 0, "end": 0, "data": 'A' }]) self.assertEqual(self._q(query.find_str_regex("ABCAB", "AB")), [{ 'start': 0, 'end': 1, 'data': 'AB' }, { 'start': 3, 'end': 4, 'data': 'AB' }]) self.assertEqual( self._q(query.find_str_regex("one fish two Fish", "[fF]ish")), [{ 'start': 4, 'end': 7, 'data': 'fish' }, { 'start': 13, 'end': 16, 'data': 'Fish' }])
def test_find_str_regex(self): self.assertJson( query.find_str_regex("one fish two Fish", "[fF]ish"), '{"findstrregex":"one fish two Fish","pattern":"[fF]ish"}')