示例#1
0
 def test_show_complement(self, jhu_data, population_data, country):
     # Setting
     dhl = DataHandler(jhu_data, population_data, country)
     dhl.init_records()
     dhl.first_date = "01Apr2020"
     dhl.last_date = "01Aug2020"
     # Test
     dhl_df = dhl.show_complement()
     data_df = jhu_data.show_complement(
         country=country, start_date="01Apr2020", end_date="01Aug2020")
     assert dhl_df.equals(data_df)
 def test_complement(self, jhu_data, population_data, country):
     dhl = DataHandler(country=country, province=None)
     with pytest.raises(NotRegisteredMainError):
         assert dhl.complemented is None
     with pytest.raises(NotRegisteredMainError):
         dhl.show_complement()
     dhl.register(jhu_data=jhu_data, population_data=population_data)
     # Not complemented
     dhl.switch_complement(whether=False)
     dhl.records_main()
     dhl.show_complement()
     assert not dhl.complemented
     # Complemented
     dhl.switch_complement(whether=True)
     dhl.records_main()
     dhl.show_complement()
     assert dhl.complemented