def test_default_config(): this_tests(Config) Config.DEFAULT_CONFIG_LOCATION = 'config_test' Config.DEFAULT_CONFIG_PATH = Config.DEFAULT_CONFIG_LOCATION + '/config.yml' try: assert Config.get() == { 'data_archive_path': str(_expand_path('~/.fastai/data')), 'data_path': str(_expand_path('~/.fastai/data')), 'model_path': str(_expand_path('~/.fastai/models')) } finally: clean_test_config(Config.DEFAULT_CONFIG_LOCATION)
def test_default_config(): this_tests(Config) Config.DEFAULT_CONFIG_LOCATION = "config_test" Config.DEFAULT_CONFIG_PATH = Config.DEFAULT_CONFIG_LOCATION + "/config.yml" try: assert Config.get() == { "data_archive_path": str(_expand_path("~/.fastai/data")), "data_path": str(_expand_path("~/.fastai/data")), "model_path": str(_expand_path("~/.fastai/models")), } finally: clean_test_config(Config.DEFAULT_CONFIG_LOCATION)
def test_creates_config(): DEFAULT_CONFIG_PATH = 'config_test/test.yml' config_path = _expand_path(DEFAULT_CONFIG_PATH) clean_path(config_path) assert not config_path.exists(), "config path should not exist" config = Config.get(config_path) assert config_path.exists( ), "Config.get should create config if it doesn't exist"
def test_creates_config(): this_tests(Config) DEFAULT_CONFIG_PATH = 'config_test/test.yml' try: config_path = _expand_path(DEFAULT_CONFIG_PATH) clean_test_config(config_path) assert not config_path.exists(), "config path should not exist" config = Config.get(config_path) assert config_path.exists(), "Config.get should create config if it doesn't exist" finally: clean_test_config(config_path) assert not config_path.exists(), "config path should not exist"
def test_creates_config(): this_tests(Config) DEFAULT_CONFIG_PATH = "config_test/test.yml" try: config_path = _expand_path(DEFAULT_CONFIG_PATH) clean_test_config(config_path) assert not config_path.exists(), "config path should not exist" config = Config.get(config_path) assert (config_path.exists() ), "Config.get should create config if it doesn't exist" finally: clean_test_config(config_path) assert not config_path.exists(), "config path should not exist"