ag_news / test_convert.py
1T Conte
fix: removed weird descpritions
94a47f5
raw
history blame
759 Bytes
"""
Module to test some previously found bugs in the convert.py file.
"""
from unittest import TestCase
from convert import _clean_html
class TestConvert(TestCase):
"""
Class to test the convert.py file.
"""
def test_clean_description(self):
"""
Test some weird description which contains a "null" value after parsed,
which causes problem when parsed by a CSV parser.
"""
description = 'null\n<div class=\'nifad\'><a href="http://www.pheedo.com/click.phdo?x=a8a276f7a37a42499f8b1c69f9acf191&u=182589199"><img src="http://www.pheedo.com/img.phdo?x=a8a276f7a37a42499f8b1c69f9acf191&u=182589199" border="0"/></a></div>'
parsed = _clean_html(description)
self.assertEqual(parsed, "")