Describe the bug
When asserting a set of strings nested inside a dataclass against the snapshot, the test may fail, due to the unsorted nature of sets. This is not the case for integer set or sets that are not nested inside a dataclass.
To reproduce
@dataclass
class Test:
my_str_set: set[str]
def __eq__(self, value: object) -> bool:
self.my_str_set == value.my_str_set
# my_int_set: set[int]
def test_set(snapshot: SnapshotAssertion) -> None:
assert snapshot == Test({"1", " 2", "3", "4", "5", "6", "7"})
# assert snapshot == Test({1, 2, 3, 4, 5, 6, 7})
# assert snapshot == {"1", " 2", "3", "4", "5", "6", "7"}
Expected behavior
The snapshot test should work out of the box, with nested sets.
Environment (please complete the following information):
- OS: Windows 11
- Syrupy Version: 4.9.1
- Python Version: 3.10.19
Describe the bug
When asserting a
setof strings nested inside adataclassagainst the snapshot, the test may fail, due to the unsorted nature ofsets. This is not the case for integer set or sets that are not nested inside adataclass.To reproduce
Expected behavior
The snapshot test should work out of the box, with nested
sets.Environment (please complete the following information):