# Path: snapshottest/formatter.py
# class Formatter(object):
#     formatters = default_formatters()
# 
#     def __init__(self, imports=None):
#         self.htchar = " " * 4
#         self.lfchar = "\n"
#         self.indent = 0
#         self.imports = imports
# 
#     def __call__(self, value, **args):
#         return self.format(value, self.indent)
# 
#     def format(self, value, indent):
#         formatter = self.get_formatter(value)
#         for module, import_name in formatter.get_imports():
#             self.imports[module].add(import_name)
#         return formatter.format(value, indent, self)
# 
#     def normalize(self, value):
#         formatter = self.get_formatter(value)
#         return formatter.normalize(value, self)
# 
#     @staticmethod
#     def get_formatter(value):
#         for formatter in Formatter.formatters:
#             if formatter.can_format(value):
#                 return formatter
# 
#         # This should never happen as GenericFormatter is registered by default.
#         raise RuntimeError("No formatter found for value")
# 
#     @staticmethod
#     def register_formatter(formatter):
#         Formatter.formatters.insert(0, formatter)


import pytest
import unittest.mock
from math import isnan
from snapshottest.formatter import Formatter
        ("one\ntwo\n", "'''one\ntwo\n'''"),
        ("three\n'''quotes", '"""three\n\'\'\'quotes"""'),
        ("so many\"\"\"\n'''quotes", "'''so many\"\"\"\n\\'\\'\\'quotes'''"),
    ],
)
def test_text_formatting(text_value, expected):
    formatter = Formatter()
    formatted = formatter(text_value)
    assert formatted == expected


@pytest.mark.parametrize(
    "text_value, expected",
    [
        ("encodage précis", "'encodage précis'"),
        ("精确的编码", "'精确的编码'"),
        # backslash [unicode repr can't just be `"u'{}'".format(value)`]
        ("omvänt\\snedstreck", "'omvänt\\\\snedstreck'"),
        # multiline
        ("ett\ntvå\n", "'''ett\ntvå\n'''"),
    ],
)
def test_non_ascii_text_formatting(text_value, expected):
    formatter = Formatter()
    formatted = formatter(text_value)
    assert formatted == expected


# https://github.com/syrusakbary/snapshottest/issues/115
def test_can_normalize_unittest_mock_call_object():

# Path: snapshottest/formatter.py
# class Formatter(object):
#     formatters = default_formatters()
# 
#     def __init__(self, imports=None):
#         self.htchar = " " * 4
#         self.lfchar = "\n"
#         self.indent = 0
#         self.imports = imports
# 
#     def __call__(self, value, **args):
#         return self.format(value, self.indent)
# 
#     def format(self, value, indent):
#         formatter = self.get_formatter(value)
#         for module, import_name in formatter.get_imports():
#             self.imports[module].add(import_name)
#         return formatter.format(value, indent, self)
# 
#     def normalize(self, value):
#         formatter = self.get_formatter(value)
#         return formatter.normalize(value, self)
# 
#     @staticmethod
#     def get_formatter(value):
#         for formatter in Formatter.formatters:
#             if formatter.can_format(value):
#                 return formatter
# 
#         # This should never happen as GenericFormatter is registered by default.
#         raise RuntimeError("No formatter found for value")
# 
#     @staticmethod
#     def register_formatter(formatter):
#         Formatter.formatters.insert(0, formatter)


# Path: tests/test_formatter.py
import pytest
import unittest.mock
from math import isnan
from snapshottest.formatter import Formatter

        ("one\ntwo\n", "'''one\ntwo\n'''"),
        ("three\n'''quotes", '"""three\n\'\'\'quotes"""'),
        ("so many\"\"\"\n'''quotes", "'''so many\"\"\"\n\\'\\'\\'quotes'''"),
    ],
)
def test_text_formatting(text_value, expected):
    formatter = Formatter()
    formatted = formatter(text_value)
    assert formatted == expected


@pytest.mark.parametrize(
    "text_value, expected",
    [
        ("encodage précis", "'encodage précis'"),
        ("精确的编码", "'精确的编码'"),
        # backslash [unicode repr can't just be `"u'{}'".format(value)`]
        ("omvänt\\snedstreck", "'omvänt\\\\snedstreck'"),
        # multiline
        ("ett\ntvå\n", "'''ett\ntvå\n'''"),
    ],
)
def test_non_ascii_text_formatting(text_value, expected):
    formatter = Formatter()
    formatted = formatter(text_value)
    assert formatted == expected


# https://github.com/syrusakbary/snapshottest/issues/115
def test_can_normalize_unittest_mock_call_object():

    formatter = Formatter()