syrusakbary / snapshottest

Snapshot Testing utils for Python 📸
MIT License
530 stars 103 forks source link

Snapshot not escaping tilt in strings #77

Closed j-jacobi closed 5 years ago

j-jacobi commented 5 years ago

Hello,

I got the following error when running some tests on a server: Coverage.py warning: Could not parse Python file /.../snap_example_tests.py because one of the snapshots was saved like this:

snapshots['MyTestClass.test_method_1 1'] = '''some text...'example''''

So I had to manually escape both tilts in the snap like this to be sure the test where working:

snapshots['MyTestClass.test_method_1 1'] = '''some text...\'example\''''

The test in the method was something like this:

snapshot.assert_match("some text...'example'")

Running on the latest package version available with python 3.5.7

Cheers