def test_for_no_tenplate(self): """ Tests method for assembling the value of a target_field that doesn't use a string template. """ parser = FieldParser(source_fields='text') actual = parser.process(self.doc) expected = 'this is an example post' self.assertEqual(actual, expected)
def test_for_string_tenplate(self): """ Tests method for assembling the value of a target_field that uses a string template. """ parser = FieldParser(source_fields='user.screen_name, id_str', formatter='https://twitter.com/{}/statuses/{}') actual = parser.process(self.doc) expected = 'https://twitter.com/zebrafinch/statuses/0123456' self.assertEqual(actual, expected)