# Path: punch/replacer.py
# class MissingSerializer(Exception):
# class Replacer(object):
#     def __init__(self, serializers, main_serialize_name='0'):
#     def update(self, serializers):
#     def run_serializer(self, serializer_name,
#                        current_version_dict, new_version_dict):
#     def run_all_serializers(self, current_version_dict, new_version_dict):
#     def replace(self, text, current_version_dict, new_version_dict):


import six
import pytest
import io
from punch import replacer




def file_like(file_content):
    if six.PY2:
        return io.StringIO(unicode(file_content))  # NOQA
    else:
        return io.StringIO(file_content)


def test_replace_content_without_config():
    with pytest.raises(TypeError):
        replacer.Replacer()


def test_process_single_serializer_string():
    serializer = "__version__ = \"{{major}}.{{minor}}.{{patch}}\""

    rep = replacer.Replacer(serializer)

    assert rep.serializers == {
        '0': "__version__ = \"{{major}}.{{minor}}.{{patch}}\""
    }


def test_update_single_serializer_string():
    serializer = "__version__ = \"{{major}}.{{minor}}.{{patch}}\""


# Path: punch/replacer.py
# class MissingSerializer(Exception):
# class Replacer(object):
#     def __init__(self, serializers, main_serialize_name='0'):
#     def update(self, serializers):
#     def run_serializer(self, serializer_name,
#                        current_version_dict, new_version_dict):
#     def run_all_serializers(self, current_version_dict, new_version_dict):
#     def replace(self, text, current_version_dict, new_version_dict):


# Path: tests/test_replacer.py
import six
import pytest
import io
from punch import replacer





def file_like(file_content):
    if six.PY2:
        return io.StringIO(unicode(file_content))  # NOQA
    else:
        return io.StringIO(file_content)


def test_replace_content_without_config():
    with pytest.raises(TypeError):
        replacer.Replacer()


def test_process_single_serializer_string():
    serializer = "__version__ = \"{{major}}.{{minor}}.{{patch}}\""

    rep = replacer.Replacer(serializer)

    assert rep.serializers == {
        '0': "__version__ = \"{{major}}.{{minor}}.{{patch}}\""
    }


def test_update_single_serializer_string():
    serializer = "__version__ = \"{{major}}.{{minor}}.{{patch}}\""


    rep = replacer.Replacer(serializer)