Page MenuHomePhabricator

Update unit test assertion in article topic model
Closed, ResolvedPublic

Description

Our unit test for article topic model is fetching outlinks for a predefined page and asserts those against a expected set of outlinks for this page.

However, the underlying page change in the meantime, which also changed the outlinks for the page as can be seen in the logs below:

    async def test_get_outlinks(page_id, lang, expected):
        with patch.object(OutlinksTopicModel, "load", return_value=True):
            t = OutlinksTopicModel("model")
            qids = await t.get_outlinks(page_id, lang)
>           assert qids == expected
E           AssertionError: assert {'Q100', 'Q10...0590158', ...} == {'Q100', 'Q10...0590158', ...}
E
E             Extra items in the left set:
E             'Q7615342'
E             'Q506250'
E             'Q122999030'
E             Extra items in the right set:
E             'Q1754'
E             Use -v to get more diff

test/unit/outlink_topic_model/test_outlink_model.py:229: AssertionError

To fix it, we should update the predefined set of outlinks in our code.

Event Timeline

Change #1195638 had a related patch set uploaded (by Bartosz Wójtowicz; author: Bartosz Wójtowicz):

[machinelearning/liftwing/inference-services@main] articletopic: Update unit tests with correct expected outlinks.

https://gerrit.wikimedia.org/r/1195638

Change #1195638 merged by jenkins-bot:

[machinelearning/liftwing/inference-services@main] articletopic: Update unit tests with correct expected outlinks.

https://gerrit.wikimedia.org/r/1195638