Skip to content

Commit c5350e6

Browse files
feat: widen allowed types for SnapshotID (#2442)
Co-authored-by: antazoey <[email protected]>
1 parent 7ccc2f2 commit c5350e6

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/ape/types/vm.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Literal, Union
1+
from typing import Any, Literal, Union
22

33
from eth_typing import HexStr
44
from hexbytes import HexBytes
@@ -14,12 +14,12 @@
1414
A type that represents contract code, which can be represented in string, bytes, or HexBytes.
1515
"""
1616

17-
SnapshotID = Union[str, int, bytes]
17+
SnapshotID = Any
1818
"""
1919
An ID representing a point in time on a blockchain, as used in the
2020
:meth:`~ape.managers.chain.ChainManager.snapshot` and
21-
:meth:`~ape.managers.chain.ChainManager.snapshot` methods. Can be a ``str``, ``int``, or ``bytes``.
22-
Providers will expect and handle snapshot IDs differently. There shouldn't be a need to change
23-
providers when using this feature, so there should not be confusion over this type in practical use
24-
cases.
21+
:meth:`~ape.managers.chain.ChainManager.snapshot` methods. Can be a ``str``, ``int``, ``bytes``,
22+
``tuple[bytes, int]``, etc. Providers will expect and handle snapshot IDs differently.
23+
There shouldn't be a need to change providers when using this feature, so there should not be
24+
confusion over this type in practical use cases.
2525
"""

tests/functional/test_fixtures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def test_isolation_restore_not_implemented(mocker, networks, fixtures):
8383
networks.active_provider = orig_provider
8484

8585

86-
@pytest.mark.parametrize("snapshot_id", (0, 1, "123"))
86+
@pytest.mark.parametrize("snapshot_id", (0, 1, "123", (b"123", 1)))
8787
def test_isolation_snapshot_id_types(snapshot_id, fixtures):
8888
class IsolationManagerWithCustomSnapshot(IsolationManager):
8989
take_call_count = 0

0 commit comments

Comments
 (0)