def test_invalid_wildcard(self): dims_dict_without_wildcard = { 'name2': ['dim1', 'dim2', 'dim3', '*'], } dims_dict_with_wildcard = {'name1': ['dim1', 'dim2', '*']} with pytest.raises(ValueError): get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard)
def test_incompatible_wildcards(self): dims_dict_without_wildcard = { 'name1': ['dim1', 'dim2'], 'name2': ['dim1', 'dim2'] } dims_dict_with_wildcard = { 'name1': ['dim1', 'dim2', '*'], 'name2': ['dim1', '*'], } with pytest.raises(IncompatibleDimensionsError): get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard)
def test_extra_dims_in_wildcard_def_with_wildcard(self): dims_dict_without_wildcard = { 'name1': ['dim2'], } dims_dict_with_wildcard = {'name1': ['dim1', '*']} result = get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard) assert result == ('dim2', )
def test_no_overlapping_names(self): dims_dict_without_wildcard = { 'name2': ['dim1', 'dim2', 'dim3', 'dim4'], } dims_dict_with_wildcard = {'name1': ['dim1', 'dim2', '*']} result = get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard) assert len(result) == 0
def test_two_overlapping_names_different_wildcard_dims(self): dims_dict_without_wildcard = { 'name1': ['dim1', 'dim2', 'dim3'], 'name2': ['dim4', 'dim5', 'dim6'], } dims_dict_with_wildcard = { 'name1': ['dim1', 'dim2', '*'], 'name2': ['*', 'dim5', 'dim6'], } result = get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard) assert len(result) == 2 assert set(result) == {'dim3', 'dim4'}
def test_empty_dims_dict_without_wildcard(self): dims_dict_without_wildcard = {} dims_dict_with_wildcard = {'name1': ['dim1', 'dim2', '*']} result = get_wildcard_dims(dims_dict_with_wildcard, dims_dict_without_wildcard) assert len(result) == 0
def test_empty_dicts(self): result = get_wildcard_dims({}, {}) assert len(result) == 0