Skip to content

Commit

Permalink
fixed linting errors and added name in contributors
Browse files Browse the repository at this point in the history
  • Loading branch information
Navjot Singh authored and Navjot Singh committed Sep 13, 2024
1 parent 65f9beb commit 73d38c8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bson/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,7 @@ def _dict_to_bson(
try:
elements.append(_element_to_bson(key, value, check_keys, opts))
except InvalidDocument as err:
raise InvalidDocument("Invalid document {} | {}".format(doc,err)) from err
raise InvalidDocument(f"Invalid document {doc} | {err}") from err
except AttributeError:
raise TypeError(f"encoder expected a mapping type but got: {doc!r}") from None

Expand Down
1 change: 1 addition & 0 deletions doc/contributors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,4 @@ The following is a list of people who have contributed to
- Ivan Lukyanchikov (ilukyanchikov)
- Terry Patterson
- Romain Morotti
- Navjot Singh (navjots18)
5 changes: 1 addition & 4 deletions test/test_bson.py
Original file line number Diff line number Diff line change
Expand Up @@ -1001,7 +1001,6 @@ def __repr__(self):
encode({"t": Wrapper(1)})

def test_doc_in_invalid_document_error_message(self):

class Wrapper:
def __init__(self, val):
self.val = val
Expand All @@ -1011,9 +1010,7 @@ def __repr__(self):

self.assertEqual("1", repr(Wrapper(1)))
doc = {"t": Wrapper(1)}
with self.assertRaisesRegex(
InvalidDocument, "Invalid document {}".format(doc)
):
with self.assertRaisesRegex(InvalidDocument, f"Invalid document {doc}"):
encode(doc)


Expand Down

0 comments on commit 73d38c8

Please sign in to comment.