Skip to content

Commit

Permalink
Update ruff.
Browse files Browse the repository at this point in the history
  • Loading branch information
shyuep committed Jan 9, 2025
1 parent c19e5f0 commit fbcdb8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ci:

repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.0
hooks:
- id: ruff
args: [--fix]
Expand Down
24 changes: 12 additions & 12 deletions tests/test_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,18 +906,18 @@ def __init__(self, name, unserializable, msonable):
# Test that skip mode preserves unserializable objects
skipped_dict = jsanitize(composite_obj, strict="skip", recursive_msonable=True)
assert skipped_dict["name"] == "test", "String values should remain unchanged"
assert (
skipped_dict["unserializable"]._a == 1
), "Unserializable object should be preserved in skip mode"
assert (
skipped_dict["msonable"]["a"] == 1
), "MSONable object should be properly serialized"
assert skipped_dict["unserializable"]._a == 1, (
"Unserializable object should be preserved in skip mode"
)
assert skipped_dict["msonable"]["a"] == 1, (
"MSONable object should be properly serialized"
)

# Test non-strict mode converts unserializable to string
dict_with_str = jsanitize(composite_obj, strict=False, recursive_msonable=True)
assert isinstance(
dict_with_str["unserializable"], str
), "Unserializable object should be converted to string in non-strict mode"
assert isinstance(dict_with_str["unserializable"], str), (
"Unserializable object should be converted to string in non-strict mode"
)

@pytest.mark.skipif(pd is None, reason="pandas not present")
def test_jsanitize_pandas(self):
Expand Down Expand Up @@ -1191,9 +1191,9 @@ def __call__(self):

callable_class_instance_name = f"{type(callable_instance).__module__}.{type(callable_instance).__qualname__}"

assert _check_type(
callable_instance, callable_class_instance_name
), callable_class_instance_name
assert _check_type(callable_instance, callable_class_instance_name), (
callable_class_instance_name
)
assert isinstance(callable_instance, MyCallableClass)

def test_numpy(self):
Expand Down

0 comments on commit fbcdb8f

Please sign in to comment.