示例#1
0
 def test_strips_scraper_id_when_appropriate(self):
     self.assertEqual(
         clean_output_row(dict(scraper_id='ice'), 'foo'),
         dict())
     self.assertEqual(
         clean_output_row(dict(scraper_id='ice'), 'scraper_foo_map'),
         dict(scraper_id='ice'))
示例#2
0
 def test_fills_is_fields(self):
     self.assertEqual(
         clean_output_row(dict(
             qux='x',
             is_quxing=True,
             is_quuxing=''), 'qux'),
         dict(qux='x',
              is_quxing=1,
              is_quuxing=0,
              is_blanchin=0))
示例#3
0
 def test_does_not_strip_other_fields(self):
     # we leave this to the database
     self.assertEqual(
         clean_output_row(dict(namespace='metasyntactic'), 'foo'),
         dict(namespace='metasyntactic'))
示例#4
0
 def test_fills_primary_key(self):
     self.assertEqual(
         clean_output_row(dict(bar=None), 'bar'),
         dict(bar='', baz=0, foo=''))
示例#5
0
 def test_empty(self):
     self.assertEqual(clean_output_row(dict(), 'foo'),
                      dict())