Skip to content

Commit

Permalink
Fix like lookups not working (#19)
Browse files Browse the repository at this point in the history
* regress tests

* fix wrong types for *like lookups supplied
  • Loading branch information
meksor committed Sep 14, 2023
1 parent b0f403b commit 1eb6d51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ixmp4/db/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ class String(str):
String: {
"__root__": (str, exact),
"in": (Iterable[str], in_),
"like": (Iterable[str], like),
"ilike": (Iterable[str], ilike),
"notlike": (Iterable[str], notlike),
"notilike": (Iterable[str], notilike),
"like": (str, like),
"ilike": (str, ilike),
"notlike": (str, notlike),
"notilike": (str, notilike),
},
}

Expand Down
3 changes: 3 additions & 0 deletions tests/data/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ def test_tabulate_model(self, test_mp):
def test_filter_model(self, test_mp):
run1, _ = create_filter_test_data(test_mp)

res = test_mp.backend.models.tabulate(name__like="Model %")
assert sorted(res["name"].tolist()) == ["Model 1", "Model 2"]

res = test_mp.backend.models.tabulate(
iamc={
"region": {"name": "Region 1"},
Expand Down

0 comments on commit 1eb6d51

Please sign in to comment.