Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ Detailing in there as much as possible, the idea and any potential solutions to

Have an issue to submit code changes for? See below.

#### Environment requirements

- `pyenv`

Comment on lines +75 to +78
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can take this out. It's going away once #1049 is merged, just haven't had the time to get back to it yet

#### Local development

- Clone the repository
Expand Down
6 changes: 4 additions & 2 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Based on conventions from https://github.com/github/scripts-to-rule-them-all
#!/bin/sh

# Based on conventions from https//github.com/github/scripts-to-rule-them-all
# script/bootstrap: Resolve all dependencies that the application requires to
# run.

Expand Down Expand Up @@ -35,6 +37,6 @@ if [[ -z $CI ]]; then
python -m python_githooks

if ! complete -p invoke &>/dev/null; then
source <(inv --print-completion-script bash)
eval $(inv --print-completion-script bash)
fi
fi
3 changes: 3 additions & 0 deletions src/syrupy/extensions/json/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ def _filter(
if isinstance(data, (datetime.datetime,)):
return data.strftime("%Y-%m-%dT%H:%M:%S.%f%z")

if isinstance(data, (datetime.date,)):
return data.strftime("%Y-%m-%d")

if isinstance(data, FunctionType):
return (
f"<{FunctionType.__name__} "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
2,
3
],
"date": "2021-01-31",
"datetime": "2021-01-31T23:59:00.000000",
"float": 4.2,
"int": -1,
Expand Down
1 change: 1 addition & 0 deletions tests/syrupy/extensions/json/test_json_filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def snapshot_json(snapshot):
"array": [1, 2, 3],
"null": None,
"datetime": datetime.datetime(2021, 1, 31, 23, 59),
"date": datetime.date(2021, 1, 31),
},
],
)
Expand Down
4 changes: 2 additions & 2 deletions tests/syrupy/extensions/json/test_json_matchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ def snapshot_json(snapshot):
def test_matcher(snapshot_json):
content = {
"int": random.randint(1, 100),
"date": datetime.datetime.utcnow(),
"date": datetime.datetime.now(datetime.UTC),
"foo": {
"x": "y",
"another_date": datetime.datetime.utcnow(),
"another_date": datetime.datetime.now(datetime.UTC),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't supported by Python 3.10 which is the minimum version of Python we support. EOL is Oct 2026. If you wanted to write a test that uses the newer syntax, you would need to use a mark to conditionally run the test on >3.10

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill adapt

},
}
matcher = path_type(
Expand Down
Loading