def test_regexp_record(self): normalizer = RegexpNormalizer(r'http://perdu.com/(?P<id>\d+).*', u'%(id)s', attr_index=1) self.assertEqual(['a1', u'42'], normalizer.normalize(['a1', u'http://perdu.com/42/supertop/cool']))
def test_regexp(self): normalizer = RegexpNormalizer(r'http://perdu.com/(?P<id>\d+).*', u'%(id)s') self.assertEqual(normalizer.normalize(u'http://perdu.com/42/supertop/cool'), u'42')