Skip to content

Commit

Permalink
fix: raised required dirty-equal to 0.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
15r10nk committed Jan 12, 2025
1 parent 793ad2f commit 5eec756
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
python-version: ${{matrix.python-version}}

- run: |
uv run ${{matrix.extra_deps}} --extra black -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto -vv
uv run ${{matrix.extra_deps}} --extra black --extra dirty-equals -m ${{ matrix.os == 'ubuntu-latest' && 'coverage run -m' || '' }} pytest -n=auto -vv
- run: |
uv run -m coverage combine
mv .coverage .coverage.${{ matrix.python-version }}-${{matrix.os}}-${{strategy.job-index}}
Expand Down
3 changes: 3 additions & 0 deletions changelog.d/20250112_213028_15r10nk-git_pydantic_ai_fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Added

- added the optional `inline-snapshot[dirty-equals]` dependency to depend on the dirty-equals version which works in combination with inline-snapshot.
7 changes: 7 additions & 0 deletions docs/eq_snapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ Example:

The date can be replaced with the [dirty-equals](https://dirty-equals.helpmanual.io/latest/) expression `IsDatetime()`.


Example:

=== "using IsDatetime()"
Expand Down Expand Up @@ -195,6 +196,12 @@ Example:
)
```

!!! note
Use the optional *dirty-equals* dependency to install the version that works best in combination with inline-snapshot.
``` sh
pip install inline-snapshot[dirty-equals]
```

### Is(...)

`Is()` can be used to put runtime values inside snapshots.
Expand Down
10 changes: 6 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ black = [
"black>=23.3.0",
"click>=8.1.4"
]
dirty-equals =[
"dirty-equals>=0.9.0",
]

[dependency-groups]
dev = [
Expand All @@ -54,7 +57,6 @@ dev = [
"coverage[toml]>=7.6.1",
"coverage-enable-subprocess>=1.0",
"pytest>=8",
"dirty-equals>=0.7.0",
"attrs>=24.3.0",
"pydantic>=1",
]
Expand Down Expand Up @@ -134,8 +136,8 @@ matrix.extra-deps.dependencies = [

[tool.hatch.envs.hatch-test]
extra-dependencies = [
"inline-snapshot[black]",
"dirty-equals>=0.7.0",
"inline-snapshot[black,dirty-equals]",
"dirty-equals>=0.9.0",
"hypothesis>=6.75.5",
"mypy>=1.2.0",
"pyright>=1.1.359",
Expand All @@ -153,7 +155,7 @@ cov-report=["coverage report","coverage html"]

[tool.hatch.envs.types]
extra-dependencies = [
"inline-snapshot[black]",
"inline-snapshot[black,dirty-equals]",
"mypy>=1.0.0",
"pytest",
"hypothesis>=6.75.5",
Expand Down
3 changes: 2 additions & 1 deletion src/inline_snapshot/_code_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ def mocked_code_repr(obj):


def value_code_repr(obj):
if not type(obj) == type(obj):
if not type(obj) == type(obj): # pragma: no cover
# this was caused by https://github.com/samuelcolvin/dirty-equals/issues/104
# dispatch will not work in cases like this
return (
f"HasRepr({repr(type(obj))}, '< type(obj) can not be compared with == >')"
Expand Down
2 changes: 2 additions & 0 deletions tests/test_dirty_equals.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import pytest
from inline_snapshot._inline_snapshot import snapshot
from inline_snapshot.testing._example import Example


@pytest.mark.xfail
def test_dirty_equals_repr():
Example(
"""\
Expand Down

0 comments on commit 5eec756

Please sign in to comment.