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'))
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))
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'))
def test_fills_primary_key(self): self.assertEqual( clean_output_row(dict(bar=None), 'bar'), dict(bar='', baz=0, foo=''))
def test_empty(self): self.assertEqual(clean_output_row(dict(), 'foo'), dict())