question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generic Representation Issues

See original GitHub issue

I’m trying to use this for snapshotting, but running into issues with GenericRepr and double quoting problems when asserting the match. I tried master since it appeared to have fixed this and run into a new issue, the GenericRepr isn’t used and instead it’s directly datetime.date(...) or Decimal(...). The problem with this is that these types were never imported to start with, so I run into type issues.

Is there a reason these are representations in Python instead of a multiline string representation like in Jest? Jest only handles formatting and compares the formatted objects which makes things simpler (e.g. does this string equal the other), while the complexity of this project seems a bit higher from equality checks.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:5
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ygormutticommented, Jul 2, 2019

Some cons of storing strings instead of objects:

  • GenericRepr is pretty much a way to store objects as strings and it’s already implemented;
  • If you want to store an object as a string other than its repr you can do it by using custom formatters;
  • https://github.com/syrusakbary/snapshottest/issues/75 presents a scenario (using pytest hooks to compare complex objects) that seems harder to accomplish if we store things as strings; i.e. it’s harder to compare objects at semantic level if they are stored as strings

The only pro I see is simplifying the comparison code. I think they did it that way in Jest because in JavaScript you can’t override ==.

1reaction
yourbuddyconnercommented, Jul 2, 2019

I agree that #82 should have most of these issues solved. However, if @blakeembrey can produce a test case that fails consistently with the new logic, the argument of serializing down to a string certainly does have merit.

I’ll leave this issue open for the time being pending seeing those test cases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Generic Representation - an overview | ScienceDirect Topics
The representation generic VF*NO processors (HW, SW, FW included) is represented as: a. Single VF: Single NO or SVSN (Multiple processes included in...
Read more >
Issues with Consistent Generic Representations ... - IEEE Xplore
Abstract—This paper discusses whether truly generic representations of radars, or other sensors are possible. It concludes that they are probably not, ...
Read more >
(PDF) Generic Representations and the Generic Grid
These issues consist of elements, knowledge structures, and design ... The second concept, the Generic representation, models generic and ...
Read more >
Generic Intent Representation in Web Search - Microsoft
Generic Intent Representation, Query Embedding, User Intent. ... of-vocabulary issues, we employ a convolutional neural network.
Read more >
On Local Coefficients for Non-generic Representations of ...
On Local Coefficients for Non-generic Representations of Some Classical Groups - Volume 116 Issue 2.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found