def test_tensorboard_get_experiments_compare_url_fail_just_one_exp(self): with pytest.raises( ValueError, match="At least two experiment_names are required." ): tensorboard_utils.get_experiments_compare_url( ("projects/123/locations/asia-east1/tensorboards/456/experiments/exp1",) )
def test_tensorboard_get_experiments_compare_url_fail_diff_region(self): with pytest.raises( ValueError, match="Got experiments from different locations: asia-east.", ): tensorboard_utils.get_experiments_compare_url(( "projects/123/locations/asia-east1/tensorboards/456/experiments/exp1", "projects/123/locations/asia-east2/tensorboards/456/experiments/exp2", ))
def test_tensorboard_get_experiments_compare_url(self): actual = tensorboard_utils.get_experiments_compare_url(( "projects/123/locations/asia-east1/tensorboards/456/experiments/exp1", "projects/123/locations/asia-east1/tensorboards/456/experiments/exp2", )) assert actual == ( "https://asia-east1.tensorboard." + "googleusercontent.com/compare/1-exp1:123+asia-east1+456+exp1," + "2-exp2:123+asia-east1+456+exp2")
def test_get_experiments_compare_url_bad_experiment_name(self): with pytest.raises(ValueError, match="Invalid experiment name: foo-bar."): tensorboard_utils.get_experiments_compare_url(("foo-bar", "foo-bar1"))