From 3680fa20bb577b817fa2dfe1081f7666f5175749 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 11 Jul 2025 10:54:24 +0200 Subject: [PATCH 1/2] add test case for gh#333 --- python/tests/match_object_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/tests/match_object_test.py b/python/tests/match_object_test.py index b3a604d56..e5636e0b0 100644 --- a/python/tests/match_object_test.py +++ b/python/tests/match_object_test.py @@ -205,6 +205,7 @@ def test_get_value_string(): c = StringDictionaryCompiler({"memory_limit_mb": "10"}) c.add("abc", "aaaaa") c.add("abd", "bbbbb") + c.add("", "{}") with tmp_dictionary(c, "match_object_string.kv") as d: m = d["abc"] assert m.value == "aaaaa" @@ -221,6 +222,10 @@ def test_get_value_string(): ) == "bbbbb" ) + m = d["abd"] + # gh#333: keyvi < 0.6.4 returned a dictionary instead of a string + assert m.value == "{}" + assert isinstance(m.value, str) def test_matched_string(): From 691ce8c96aaea364634e6fa3b92cae294aa5c788 Mon Sep 17 00:00:00 2001 From: Hendrik Muhs Date: Fri, 18 Jul 2025 21:21:48 +0200 Subject: [PATCH 2/2] fix example testcase --- python/tests/match_object_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/tests/match_object_test.py b/python/tests/match_object_test.py index e5636e0b0..a49292e4a 100644 --- a/python/tests/match_object_test.py +++ b/python/tests/match_object_test.py @@ -205,7 +205,7 @@ def test_get_value_string(): c = StringDictionaryCompiler({"memory_limit_mb": "10"}) c.add("abc", "aaaaa") c.add("abd", "bbbbb") - c.add("", "{}") + c.add("abe", "{}") with tmp_dictionary(c, "match_object_string.kv") as d: m = d["abc"] assert m.value == "aaaaa" @@ -222,7 +222,7 @@ def test_get_value_string(): ) == "bbbbb" ) - m = d["abd"] + m = d["abe"] # gh#333: keyvi < 0.6.4 returned a dictionary instead of a string assert m.value == "{}" assert isinstance(m.value, str)