

@patch('openelex.base.datasource.elec_api.find')
def test_filename_url_pairs_filterd_by_year(self, mock_elec_find):
    mock_elec_find.return_value = md_data['objects']
    pairs = self.datasource.filename_url_pairs(2012)
    expected = [('20121106__md__general__state_legislative.csv', 'http://www.elections.state.md.us/elections/2012/election_data/State_Legislative_Districts_2012_General.csv'), ('20120403__md__democratic__primary__state_legislative.csv', 'http://www.elections.state.md.us/elections/2012/election_data/State_Legislative_Districts_Democratic_2012_Primary.csv'), ('20121106__md__general__allegany.csv', 'http://www.elections.state.md.us/elections/2012/election_data/Allegany_County_2012_General.csv'), ('20121106__md__general__allegany__precinct.csv', 'http://www.elections.state.md.us/elections/2012/election_data/Allegany_By_Precinct_2012_General.csv'), ('20120403__md__democratic__primary__allegany.csv', 'http://www.elections.state.md.us/elections/2012/election_data/Allegany_County_Democratic_2012_Primary.csv'), ('20120403__md__democratic__primary__allegany__precinct.csv', 'http://www.elections.state.md.us/elections/2012/election_data/Allegany_By_Precinct_Democratic_2012_Primary.csv')]
    unexpected = [('20001107__md__general__state_legislative.csv', 'http://www.elections.state.md.us/elections/2000/election_data/State_Legislative_Districts_General_2000.csv'), ('20041102__md__general__state_legislative.csv', 'http://www.elections.state.md.us/elections/2004/election_data/State_Legislative_Districts_General_2004.csv'), ('20041102__md__general__allegany.csv', 'http://www.elections.state.md.us/elections/2004/election_data/Allegany_County_General_2004.csv'), ('20040302__md__democratic__primary__allegany.csv', 'http://www.elections.state.md.us/elections/2004/election_data/Allegany_County_Democratic_Primary_2004.csv'), ('20021105__md__general.txt', 'http://www.elections.state.md.us/elections/2002/results/g_all_offices.txt'), ('20020910__md__primary.txt', 'http://www.elections.state.md.us/elections/2002/results/p_all_offices.txt')]
    for pair in expected:
        self.assertIn(pair, pairs)
    for pair in unexpected:
        self.assertNotIn(pair, pairs)

dataset/ETHPy150Open openelections/openelections-core/openelex/tests/test_md_datasource.py TestUrlFilenameMappings.test_filename_url_pairs_filterd_by_year/original