Skip to content

Commit 3b1beb3

Browse files
authored
Fix value error formatting (#1827)
1 parent 9da36a8 commit 3b1beb3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

faker/providers/python/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def pyobject(
8787
elif object_type == dict:
8888
return self.pydict()
8989
else:
90-
raise ValueError("Object type `{object_type}` is not supported by `pyobject` function")
90+
raise ValueError(f"Object type `{object_type}` is not supported by `pyobject` function")
9191

9292
def pybool(self, truth_probability: int = 50) -> bool:
9393
"""

tests/providers/test_python.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_pyobject(
2424

2525
@pytest.mark.parametrize("object_type", (object, type, callable))
2626
def test_pyobject_with_unknown_object_type(object_type):
27-
with pytest.raises(ValueError):
27+
with pytest.raises(ValueError, match=f"Object type `{object_type}` is not supported by `pyobject` function"):
2828
assert Faker().pyobject(object_type=object_type)
2929

3030

0 commit comments

Comments
 (0)