def setUpClass(cls) -> None:
     cls.resultdir = tempfile.TemporaryDirectory().name
     cls.dataDir = os.path.join(cls.resultdir, "data")
     cls.subdir_level = "data/demographics/contact_matrices_152_countries"
     cls.sourcedir = os.path.join(
         os.path.dirname(os.path.dirname(__file__)), cls.subdir_level)
     utilities.copy_input(cls.sourcedir, cls.resultdir, cls.subdir_level)
     cfg.set_nbrackets(20)
Beispiel #2
0
 def test_usa_state_path_methods(self):
     cfg.set_nbrackets(20)
     keywords = ["get", "path"]
     args = ['country_location', 'state_location']
     ignored_args = ['location', 'part']
     exclude_pattern = ["school", "long_term_care_facility"]
     methods = self.get_methods_to_test(keywords=keywords,
                                        target_args=args,
                                        exclude_args=ignored_args,
                                        exclude_pattern=exclude_pattern)
     datadir = sp.datadir
     # sp.cfg.set_location_defaults("usa")
     testcase = {"country_location": "usa", "state_location": "Washington"}
     self.run_tests(datadir, methods, testcase)
Beispiel #3
0
 def test_seattle_path_methods(self):
     cfg.set_nbrackets(20)
     keywords = ["get", "path"]
     exclude_pattern = ["household_head_age_by_size", "workplace_size"]
     methods = self.get_methods_to_test(keywords=keywords,
                                        exclude_pattern=exclude_pattern)
     datadir = sp.datadir
     # sp.cfg.set_location_defaults("usa")
     testcase = {
         "country_location": "usa",
         "state_location": "Washington",
         "location": "seattle_metro"
     }
     self.run_tests(datadir, methods, testcase)
Beispiel #4
0
 def test_portland_methods(self):
     cfg.set_nbrackets(16)
     keywords = ["get", "path"]
     exclude_pattern = [
         "school", "long_term_care_facility", "household_head_age_by_size"
     ]
     methods = self.get_methods_to_test(keywords=keywords,
                                        exclude_pattern=exclude_pattern)
     datadir = sp.datadir
     # sp.cfg.set_location_defaults("usa")
     testcase = {
         "country_location": "usa",
         "state_location": "Oregon",
         "location": "portland_metro"
     }
     self.run_tests(datadir, methods, testcase)
Beispiel #5
0
 def test_seattle_data_methods(self):
     cfg.set_nbrackets(20)
     keywords = ["get", "distr"]
     exclde_pattern = ["path", "head_age_by_size", "workplace_size"]
     methods = self.get_methods_to_test(exclude_pattern=exclde_pattern,
                                        keywords=keywords)
     for m in methods:
         print(m[0])
     datadir = sp.datadir
     # sp.cfg.set_location_defaults("usa")
     testcase = {
         "country_location": "usa",
         "state_location": "Washington",
         "location": "seattle_metro"
     }
     self.run_tests(datadir, methods, testcase, ispath=False)
Beispiel #6
0
 def test_senegal_state_path_methods(self):
     cfg.set_nbrackets(18)
     exclude_pattern = [
         "get_usa", "get_gender_fraction_by_age",
         "get_school_size_distr_by_type", "get_school_type_age_ranges_path",
         "get_long_term_"
     ]
     keywords = ["get", "path"]
     args = ['country_location', 'state_location']
     ignored_args = ['location', 'part']
     methods = self.get_methods_to_test(exclude_pattern=exclude_pattern,
                                        keywords=keywords,
                                        target_args=args,
                                        exclude_args=ignored_args)
     datadir = sp.datadir
     # sp.cfg.set_location_defaults("Senegal")
     testcase = {"country_location": "Senegal", "state_location": "Dakar"}
     self.run_tests(datadir, methods, testcase)
Beispiel #7
0
 def test_dakar_data_methods(self):
     cfg.set_nbrackets(18)
     keywords = ["get", "distr"]
     exclude_pattern = [
         "get_usa", "path", "get_gender_fraction_by_age", "get_age_bracket",
         "get_school_size_distr_by_type", "get_school_type_age_ranges_path",
         "get_long_term_"
     ]
     methods = self.get_methods_to_test(exclude_pattern=exclude_pattern,
                                        keywords=keywords)
     for m in methods:
         print(m[0])
     datadir = sp.datadir
     testcase = {
         "country_location": "Senegal",
         "state_location": "Dakar",
         "location": "Dakar"
     }
     self.run_tests(datadir, methods, testcase, ispath=False)