Skip to content

Commit

Permalink
reformat message
Browse files Browse the repository at this point in the history
  • Loading branch information
lazargugleta committed Jun 27, 2024
1 parent b320fb0 commit 5489ff1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bindings/python/pymongoarrow/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def _normalize_typeid(typeid, field_name):
fields.append((sub_field_name, _normalize_typeid(sub_typeid, sub_field_name)))
return struct(fields)
if isinstance(typeid, list):
if len(typeid) == 0 or len(typeid) > 1:
msg = "Please provide a one datatype or struct in case of multiple datatypes in a list"
if len(typeid) != 1:
msg = f"list field in schema must contain exactly one element, not {len(typeid)}"
raise ValueError(msg)
return list_(_normalize_typeid(typeid[0], "0"))
if _is_typeid_supported(typeid):
Expand Down
4 changes: 2 additions & 2 deletions bindings/python/test/test_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def test_py_list_projection(self):

def test_py_list_with_multiple_fields_raises(self):

with pytest.raises(ValueError, match="Please provide a one datatype or struct in case of multiple datatypes in a list"):
with pytest.raises(ValueError, match="list field in schema must contain exactly one element, not 2"):
_ = Schema(
{
"_id": ObjectId,
Expand All @@ -118,7 +118,7 @@ def test_py_list_with_multiple_fields_raises(self):

def test_py_empty_list_raises(self):

with pytest.raises(ValueError, match="Please provide a one datatype or struct in case of multiple datatypes in a list"):
with pytest.raises(ValueError, match="list field in schema must contain exactly one element, not 0"):
_ = Schema(
{
"_id": ObjectId,
Expand Down

0 comments on commit 5489ff1

Please sign in to comment.