예제 #1
0
def test_read():
    params = read_config("./datasets/configs/config4.json")
    exp = {
        "param1": 69,
        "param2": {"nestedParam": 420},
        "Split": 6969,
        "df": "./datasets/encoding/test.csv",
    }
    assert params == exp
예제 #2
0
def test_save():
    filepath = "./datasets/configs/params.json"
    params = {
        "param1": 69,
        "param2": {
            "nestedParam": 420
        },
        "Split": 6969,
    }
    save_config(filepath, params)
    contents = read_config(filepath)
    assert params == contents
예제 #3
0
def test_save():
    filepath = "./datasets/configs/params.json"
    params = {
        "param1": 69,
        "param2": {"nestedParam": 420},
        "Split": 6969,
        "df": "./datasets/encoding/test.csv",
    }
    save_config(filepath, params)
    contents = read_config(filepath)
    params.pop("df")
    assert params == contents
예제 #4
0
 def test_jsonload(self):
     with pytest.raises(TypeError):
         c = read_config("./datasets/configs/config2.json")
예제 #5
0
 def test_filenotfound(self):
     with pytest.raises(FileNotFoundError):
         c = read_config("/usr/src/app/config.json")
예제 #6
0
 def test_df(self):
     with pytest.raises(FileNotFoundError):
         c = read_config("./datasets/configs/config_df.json")