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
Describe the bug
I just started getting an error with Syrupy today when adding a new integration test for an API endpoint I am working on. I use Syrupy to diff the json returned vs a snapshot. When updating the snapshot (since it doesn't exist yet) I get an error that seems to be related to the presence of asian characters.
snapshot = SnapshotAssertion(name='snapshot', num_executions=1)
def test_get_mythic_raid_leaderboard(snapshot):
client = WarcraftClient(os.getenv("CLIENT_ID"), os.getenv("CLIENT_SECRET"))
response = client.get_mythic_raid_leaderboard("uldir", "alliance")
> assert response == snapshot
src\tests\integration\test_warcraft_client.py:296:
.venv\lib\site-packages\syrupy\assertion.py:123: in __eq__
return self._assert(other)
.venv\lib\site-packages\syrupy\assertion.py:138: in _assert
self.extension.write_snapshot(
.venv\lib\site-packages\syrupy\extensions\base.py:146: in write_snapshot
self._write_snapshot_fossil(snapshot_fossil=snapshot_fossil)
.venv\lib\site-packages\syrupy\extensions\amber.py:317: in _write_snapshot_fossil
DataSerializer.write_file(snapshot_fossil_to_update)
.venv\lib\site-packages\syrupy\extensions\amber.py:46: in write_file
f.write(f"{cls._indent}{data_line}")
self = <encodings.cp1252.IncrementalEncoder object at 0x00000219EF7B9C10>, input = " 'name': '阿尔法',\n", final = False
def encode(self, input, final=False):
> return codecs.charmap_encode(input,self.errors,encoding_table)[0]
E UnicodeEncodeError: 'charmap' codec can't encode characters in position 19-21: character maps to <undefined>
..\..\AppData\Local\Programs\Python\Python38\lib\encodings\cp1252.py:19: UnicodeEncodeError
@tehmufifnman thanks for raising the issue, might be limited to windows which I don't have access to test with atm. However potential fix in the works here #198, you can test it out by installing the PR version of syrupy and and reporting back with results.
Thanks @iamogbz ! This did indeed fix my issue, with one caveat. Since my original snapshot was written with the old encoding, it errored when trying to read it (even with --update-snapshot). Once I deleted the old ambr file and let it create a brand new one, it worked across the board.
Describe the bug
I just started getting an error with Syrupy today when adding a new integration test for an API endpoint I am working on. I use Syrupy to diff the json returned vs a snapshot. When updating the snapshot (since it doesn't exist yet) I get an error that seems to be related to the presence of asian characters.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect it to save a new initial snapshot.
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: