# Path: snapshottest/file.py
# class FileSnapshot(object):
#     def __init__(self, path):
#         """
#         Create a file snapshot pointing to the specified `path`. In a snapshot, `path`
#         is considered to be relative to the test module's "snapshots" folder. (This is
#         done to prevent ugly path manipulations inside the snapshot file.)
#         """
#         self.path = path
# 
#     def __repr__(self):
#         return "FileSnapshot({})".format(repr(self.path))
# 
#     def __eq__(self, other):
#         return self.path == other.path


from collections import defaultdict
from snapshottest.file import FileSnapshot


def test_object(snapshot):
    """
    Test a snapshot with a custom object. The object will be represented in the
    snapshot using `snapshottest.GenericRepr`. The snapshot will only match if the
    object's repr remains the same.
    """
    test_value = SomeObject(3)
    snapshot.assert_match(test_value)


def test_file(snapshot, tmpdir):
    """
    Test a file snapshot. The file contents will be saved in a sub-folder of the
    snapshots folder. Useful for large files (e.g. media files) that aren't suitable
    for storage as text inside the snap_***.py file.
    """
    temp_file = tmpdir.join("example.txt")
    temp_file.write("Hello, world!")
    snapshot.assert_match(FileSnapshot(str(temp_file)))


def test_multiple_files(snapshot, tmpdir):
    """
    Each file is stored separately with the snapshot's name inside the module's file
    snapshots folder.
    """
    temp_file1 = tmpdir.join("example1.txt")
    temp_file1.write("Hello, world 1!")

# Path: snapshottest/file.py
# class FileSnapshot(object):
#     def __init__(self, path):
#         """
#         Create a file snapshot pointing to the specified `path`. In a snapshot, `path`
#         is considered to be relative to the test module's "snapshots" folder. (This is
#         done to prevent ugly path manipulations inside the snapshot file.)
#         """
#         self.path = path
# 
#     def __repr__(self):
#         return "FileSnapshot({})".format(repr(self.path))
# 
#     def __eq__(self, other):
#         return self.path == other.path


# Path: examples/pytest/test_demo.py
from collections import defaultdict
from snapshottest.file import FileSnapshot



def test_object(snapshot):
    """
    Test a snapshot with a custom object. The object will be represented in the
    snapshot using `snapshottest.GenericRepr`. The snapshot will only match if the
    object's repr remains the same.
    """
    test_value = SomeObject(3)
    snapshot.assert_match(test_value)


def test_file(snapshot, tmpdir):
    """
    Test a file snapshot. The file contents will be saved in a sub-folder of the
    snapshots folder. Useful for large files (e.g. media files) that aren't suitable
    for storage as text inside the snap_***.py file.
    """
    temp_file = tmpdir.join("example.txt")
    temp_file.write("Hello, world!")
    snapshot.assert_match(FileSnapshot(str(temp_file)))


def test_multiple_files(snapshot, tmpdir):
    """
    Each file is stored separately with the snapshot's name inside the module's file
    snapshots folder.
    """
    temp_file1 = tmpdir.join("example1.txt")
    temp_file1.write("Hello, world 1!")

    snapshot.assert_match(FileSnapshot(str(temp_file1)))