mirror of https://github.com/scrapy/scrapy.git
ItemLoader: add test for adding a dict value
After arg_to_iter is changed to return [arg] if arg is a dict, the added test will pass. Signed-off-by: Ping Yin <pkufranky@gmail.com>
This commit is contained in:
parent
8497301784
commit
8f53a72306
|
|
@ -61,6 +61,10 @@ class ItemLoaderTest(unittest.TestCase):
|
|||
self.assertEqual(il.get_collected_values('name'), [u'Marta', u'Pepe'])
|
||||
self.assertEqual(il.get_output_value('name'), [u'Marta', u'Pepe'])
|
||||
|
||||
# test add object value
|
||||
il.add_value('summary', {'key': 1})
|
||||
self.assertEqual(il.get_collected_values('summary'), [{'key': 1}])
|
||||
|
||||
il.add_value(None, u'Jim', lambda x: {'name': x})
|
||||
self.assertEqual(il.get_collected_values('name'), [u'Marta', u'Pepe', u'Jim'])
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue