mirror of
https://github.com/soxoj/maigret.git
synced 2026-09-22 17:54:55 +02:00
Don't crash when an extracted identity value isn't a string (#3039)
This commit is contained in:
+1
-1
@@ -96,7 +96,7 @@ def get_dict_ascii_tree(items, prepend="", new_line=True):
|
||||
|
||||
if isinstance(item, tuple):
|
||||
field_name, field_value = item
|
||||
if field_value.startswith("['"):
|
||||
if isinstance(field_value, str) and field_value.startswith("['"):
|
||||
is_last_item = num == len(items) - 1
|
||||
prepend_symbols = " " * 3 if is_last_item else f" {skip_result} "
|
||||
data = ascii_data_display(field_value)
|
||||
|
||||
@@ -191,6 +191,10 @@ def test_get_dict_ascii_tree():
|
||||
)
|
||||
|
||||
|
||||
def test_get_dict_ascii_tree_handles_non_string_values():
|
||||
assert get_dict_ascii_tree([('uid', 42)], new_line=False) == '└─uid: 42'
|
||||
|
||||
|
||||
def test_get_match_ratio():
|
||||
fun = get_match_ratio(["test", "maigret", "username"])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user