syrusakbary / snapshottest

Snapshot Testing utils for Python 📸
MIT License
525 stars 102 forks source link

Generated python snapshot has syntax error if artifact ends in single quote #159

Open alexharv074 opened 3 years ago

alexharv074 commented 3 years ago

It appears that the snapshots produced by this library are delimited by three single quotes. If, however, the snapshot data ends in a single quote, the file snapshots/test_SOMETHING.py ends up with a syntax error in it, and the following error message is seen:

...                                                                                                                                                  
    Export:                                                                                                                                                                       
      Name: !Sub '${AWS::StackName}-SQSQueue''''
                                               ^                                                                                                                                  
SyntaxError: EOL while scanning string literal                                                                                                                                    

This library perhaps should test the data for the delimiter to ensure this is avoided.