def test_merge_word(): #self, word, link=None, usage_count=1, first=None, last=None aword = w.Word('zeit', 'https://example.com', 3, '2020-05-15', '2020-05-15') other = w.Word('zeit', 'https://example.com/other', 1, '2020-01-15', '2020-03-15') aword = aword.merge(other) assert aword.word == 'zeit' assert aword.links == ['https://example.com'] assert aword.usage_count == 4 assert aword.first == '2020-01-15' assert aword.last == '2020-05-15'
def test_word_as_empty_json_if_obsolete(): word = w.Word('a', None, 1, '2020-01-01', '2020-02-01') assert word._as_json_snippet() == ''
def test_word_relevant_for_days(): word = w.Word('zeit', None, 3, '2020-08-15', '2020-09-01') assert word.relevant_for_days() == 17
def test_word_as_empty_json_snippet_if_it_is_on_filter_list(): word = w.Word('a', None, 1, '2020-08-15', '2020-09-01') assert word._as_json_snippet() == ''
def test_word_as_json_snippet(): word = w.Word('zeit', None, 3, '2020-08-15', '2020-09-01') assert word._as_json_snippet() == '"zeit": {"first": "2020-08-15", "last": "2020-09-01"},'