[py] consequences of allowing snapshots based on repr
- Vorherrschende Sprache
- Kotlin
- Sterne
- 101
- Forks
- 18
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
Python has a very cool `repr()` method, which returns the source code required to create the object. Not everything implements it, but Python's core datastructures do.
For inline snapshots it's pretty easy - we call `repr()` on argument, and put that inside the `to_be()` call.
For disk snapshots, we would have to read the value from the snapshot, call `eval()` on that string, and then hope that the comparison logic is implemented correctly.
In both cases, it muddies the concept of equality a bit, but allowing repr is so convenient that it's worth it.

Beitragsleitfaden
Rechercherichtung
Das Issue behandelt Inline-Snapshots, die repr() verwenden, und Disk-Snapshots, die Werte mit eval() lesen, nennt jedoch keine Dateien oder Tests. Beginne damit, die Vergleichspfade für Inline- und Disk-Snapshots zu finden, und ermittle dann, wie auf repr() basierende Werte behandelt werden sollten und wie die Gleichheit validiert wird. Erledigt ist die Aufgabe, wenn ein abgestimmtes Verhalten und die entsprechende Abdeckung für beide Snapshot-Modi vorhanden sind.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- testing
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100