def it_returns_non_none_if_old_and_new_different(): new_config = Munch(a=1, b=2) utils.json_save("/tmp/config.json", new_config) new_config["c"] = 3 assert ( PipelineTask._config_dirty(new_config, "/tmp/config.json") is not None )
def it_returns_non_none_if_old_un_parseable(): with open("/tmp/config.json", "w") as f: f.write("This is not json") assert ( PipelineTask._config_dirty(Munch(a=1), "/tmp/config.json") is not None )
def it_returns_non_none_if_old_not_found(): assert ( PipelineTask._config_dirty(Munch(a=1), "/tmp/doesnt_exist_config.json") is not None )
def it_returns_none_if_old_and_new_differ_only_by_underscore_blocks(): new_config = Munch(a=1, b=2, _c=3) utils.json_save("/tmp/config.json", new_config) new_config["_c"] = 4 assert PipelineTask._config_dirty(new_config, "/tmp/config.json") is None
def it_returns_none_if_old_and_new_identical(): new_config = Munch(a=1, b=2) utils.json_save("/tmp/config.json", new_config) assert PipelineTask._config_dirty(new_config, "/tmp/config.json") is None
def it_returns_none_on_old_config_missing(): assert PipelineTask._config_dirty("test", None) is None
def it_returns_none_on_new_config_missing(): assert PipelineTask._config_dirty(None, "test") is None