rich-pixels icon indicating copy to clipboard operation
rich-pixels copied to clipboard

Add staticmethod to parse base64 encoded images

Open murilo-cunha opened this issue 3 years ago • 4 comments

Summary of changes:

  • Add from_base64_image static method
  • Add sample base64 image as a text file
    • Test is not passing :(

Feel free to close this, but I actually had to write this up for my project, so I figured I'd open a PR here too.

Also could not quite figure out how to write the test with syrupy...

murilo-cunha avatar Nov 13 '22 16:11 murilo-cunha

You need to run pytest --snapshot-update to save the snapshot to disk (and check it looks correct).

Then, every time that test runs in the future, it'll validate that the output doesn't change compared to that snapshot.

darrenburns avatar Nov 13 '22 16:11 darrenburns

Ahhh yeah thanks!! That worked perfectly, and all tests passed 🚀

murilo-cunha avatar Nov 13 '22 18:11 murilo-cunha

It should have generated a new snapshot image, which you'll also need to push up to this PR so that when other people run your test, it checks the output of the test against that snapshot :)

darrenburns avatar Nov 13 '22 18:11 darrenburns

There you go! Thanks for the quick response! ⚡ ⚡

murilo-cunha avatar Nov 13 '22 18:11 murilo-cunha