You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it makes sense to add quotes in the repr so I went and created #1701. However, I'm not sure inline-snapshot is taking a robust approach here by assuming eval(repr(obj)) works for any obj. In the case of TzInfo, TzInfo("UTC") (or any kind of non-integer argument) fails, and there's no unspoken rule that I know of stating that the evaluation of Python objects representations should result in the same object being re-created.
there's no unspoken rule that I know of stating that the evaluation of Python objects representations should result in the same object being re-created.
If at all possible, this should look like a valid Python expression that could be used to recreate an object with the same value (given an appropriate environment)
Hi, I'm the author of inline-snapshot and have a problem with the way
TzInfo.__repr__
is implemented.TzInfo has currently the following repr:
The problem is that inline-snapshot uses by default
repr()
to generate the python code for the snapshots.inline-snapshot users then try to import UTC from somewhere which causes other problems.
Is it possible to change the repr() result of TzInfo to the following (add
""
).And to provide the possibility for TzInfo to be constructed from a string?
This should make
work for all TzInfo objects.
The text was updated successfully, but these errors were encountered: