Exemplo n.º 1
0
def test_create_SIRS_machine():
    #Pretest
    Params.clean()
    SIRS.clean()
    config_path = os.path.join(os.path.dirname(__file__), "..", "src",
                               "config.json")
    with open(config_path) as json_data_file:
        ConfigData = json.load(json_data_file)
        paramsDataPath = ConfigData['ParamsFilePath']
    Params.load_from(os.path.join(os.path.dirname(__file__), "..", "src",
                                  paramsDataPath),
                     override=True)

    b = SIRS.make()
    assert isinstance(b, SIRS)
Exemplo n.º 2
0
def test_latent_no_incubating():
    #Pretest
    Params.clean()
    SIRS.clean()
    config_path = os.path.join(os.path.dirname(__file__), "tests_config_files",
                               "test_latent_no_incubating_config.json")
    with open(config_path) as json_data_file:
        ConfigData = json.load(json_data_file)
        paramsDataPath = ConfigData['ParamsFilePath']
    Params.load_from(os.path.join(os.path.dirname(__file__),
                                  "tests_params_files", paramsDataPath),
                     override=True)

    p = Person(30)
    for _ in range(100):
        for cur_type in machine_type:
            tbl = sample_seir_times(cur_type, p)
            assert tbl[0][0] == DiseaseState.LATENT, "{}".format(cur_type.name)
            assert tbl[1][
                0] == DiseaseState.ASYMPTOMATICINFECTIOUS, "{}".format(
                    cur_type.name)
            assert tbl[2][0] == DiseaseState.IMMUNE, "{}".format(cur_type.name)