From e1104f955d50d18fed100e77e420ac1f40a9f557 Mon Sep 17 00:00:00 2001 From: Eduardo Lauer Date: Wed, 21 Feb 2024 10:05:04 -0300 Subject: [PATCH] create test for match_department --- tests/searchers_test.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/searchers_test.py b/tests/searchers_test.py index 4c64152..a407d0d 100644 --- a/tests/searchers_test.py +++ b/tests/searchers_test.py @@ -104,6 +104,35 @@ def test_is_signature(dou_searcher, search_term, abstract): def test_really_matched(dou_searcher, search_term, abstract): assert dou_searcher._really_matched(search_term, abstract) +def test_match_department(dou_searcher): + department = ['Ministério da Defesa'] + results = [ + { + "section": "Seção 3", + "title": "EXTRATO DE COMPROMISSO", + "href": "https://www.in.gov.br/web/dou/-/extrato-de-compromisso-342504508", + "abstract": "ALESSANDRO GLAUCO DOS ANJOS DE VASCONCELOS - Secretário-Executivo Adjunto...", + "date": "02/09/2021", + "hierarchyList": ["Ministério da Defesa", + "Comando do Exército", + "Comando Militar do Nordeste", + "6ª Região Militar", + "28º Batalhão de Caçadores"], + }, + { + "section": "Seção 3", + "title": "EXTRATO DE COMPROMISSO", + "href": "https://www.in.gov.br/web/dou/-/extrato-de-compromisso-342504508", + "abstract": "ALESSANDRO GLAUCO DOS ANJOS DE VASCONCELOS - Secretário-Executivo Adjunto...", + "date": "02/09/2021", + "hierarchyList": ["Ministério dos Povos Indígenas"], + } + ] + dou_searcher._match_department(results, department) + assert len(results) == 1 + + + @pytest.mark.parametrize( 'pre_term_list, casted_term_list', [