syrusakbary / snapshottest

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

GenericRepr and Snapshot are changing their places in Import statement #121

Open jaswanthm1855 opened 4 years ago

jaswanthm1855 commented 4 years ago

Whenever I am performing snapshot test on functions which returns DTOs, The import statement is keep on changing or modifying,

For first run I will get - from snapshottest import Snapshot, GenericRepr then for next run it is changing - from snapshottest import GenericRepr, Snapshot

Example File is as follows: snapshot_keep_on_modifying.txt

The above file contents are like this

# -*- coding: utf-8 -*-
# snapshottest: v1 - https://goo.gl/zC4yUc
from __future__ import unicode_literals

from snapshottest import Snapshot, GenericRepr

snapshots = Snapshot()

snapshots['TestExample.test_run_example result'] = (
    [
        GenericRepr("ExampleDTO(example_id='f2c02d98-f311-4ab2-8673-3daa00757002', name='example1', description='desc1')"),
        GenericRepr("ExampleDTO(example_id='aa66c40f-6d93-484a-b418-984716514c7b', name='example2', description='desc2')"),
    ],
    3
)
davidshepherd7 commented 4 years ago

Hi, I had a similar problem which I think is fixed by one of my PRs, probably #116 but I can't really remember. Hopefully the fix will be merged soon.

paulmelnikow commented 4 years ago

@jaswanthm1855 Could you try the latest commit to master and see if that fixes the problem?