def compare(name): html = os.path.join(folder, '%s.html' % name) with open(html) as f: parsed = hentry.parse_html(f.read()) j = os.path.join(folder, '%s.json' % name) with open(j) as f: expect = json.load(f) pubdate = expect.get('pubdate') # fix pubdate if pubdate: expect['pubdate'] = hentry.to_datetime(pubdate) assert parsed == expect
def test_to_datetime(): # no value assert hentry.to_datetime(None) is None # invalid value assert hentry.to_datetime('foobar') is None