def test_records_main(self, jhu_data, country):
     dhl = DataHandler(country=country, province=None)
     with pytest.raises(NotRegisteredMainError):
         dhl.records_main()
     dhl.register(jhu_data=jhu_data)
     main_df = dhl.records_main()
     assert set(main_df.columns) == set([Term.DATE, Term.C, Term.CI, Term.F, Term.R, Term.S])
 def test_timepoints(self, jhu_data, country):
     dhl = DataHandler(country=country, province=None, jhu_data=jhu_data)
     dhl.timepoints(first_date="01Apr2020", last_date="01Sep2020", today="01Jun2020")
     series = dhl.records_main()[Term.DATE]
     assert series.min().strftime(Term.DATE_FORMAT) == dhl.first_date == "01Apr2020"
     assert series.max().strftime(Term.DATE_FORMAT) == dhl.last_date == "01Sep2020"
     assert dhl.today == "01Jun2020"
Ejemplo n.º 3
0
 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
Ejemplo n.º 4
0
 def test_records_main(self, jhu_data, population_data, country):
     dhl = DataHandler(country=country, province=None)
     with pytest.raises(NotRegisteredMainError):
         dhl.records_main()
     dhl.register(jhu_data=jhu_data, population_data=population_data)
     assert dhl.population == population_data.value(country=country)