# Path: django_test_tools/utils.py
# def convert_to_snake_case(camel_case):
#     """
#     Converts a CamelCase name to snake case.
#     ..code-block:: python
# 
#         camel_case = 'OperatingSystemLongName'
#         snake_case = convert_to_snake_case(camel_case)
#         self.assertEqual(snake_case, 'operating_system_long_name')
# 
#     :param camel_case: string. Camel case name
#     :return: string. Snake case name
#     """
#     s1 = first_cap_re.sub(r'\1_\2', camel_case)
#     return all_cap_re.sub(r'\1_\2', s1).lower()


from ..utils import convert_to_snake_case

PRINT_IMPORTS = ['from django.forms.models import model_to_dict',
                 'from django.conf import settings',
                 'from django.test import TestCase',
                 'from django.db import IntegrityError'
                 ]
PRINT_TEST_CLASS = """
class TestCase{0}(TestCase):

    def test_create(self):
        \"\"\"
        Test the creation of a {0} model using a factory
        \"\"\"
        {1} = {0}Factory.create()
        self.assertEqual({0}.objects.count(), 1)

    def test_create_batch(self):
        \"\"\"
        Test the creation of 5 {0} models using a factory
        \"\"\"
        {1}s = {0}Factory.create_batch(5)
        self.assertEqual({0}.objects.count(), 5)

# Path: django_test_tools/utils.py
# def convert_to_snake_case(camel_case):
#     """
#     Converts a CamelCase name to snake case.
#     ..code-block:: python
# 
#         camel_case = 'OperatingSystemLongName'
#         snake_case = convert_to_snake_case(camel_case)
#         self.assertEqual(snake_case, 'operating_system_long_name')
# 
#     :param camel_case: string. Camel case name
#     :return: string. Snake case name
#     """
#     s1 = first_cap_re.sub(r'\1_\2', camel_case)
#     return all_cap_re.sub(r'\1_\2', s1).lower()


# Path: django_test_tools/generators/model_test_gen.py
from ..utils import convert_to_snake_case


PRINT_IMPORTS = ['from django.forms.models import model_to_dict',
                 'from django.conf import settings',
                 'from django.test import TestCase',
                 'from django.db import IntegrityError'
                 ]
PRINT_TEST_CLASS = """
class TestCase{0}(TestCase):

    def test_create(self):
        \"\"\"
        Test the creation of a {0} model using a factory
        \"\"\"
        {1} = {0}Factory.create()
        self.assertEqual({0}.objects.count(), 1)

    def test_create_batch(self):
        \"\"\"
        Test the creation of 5 {0} models using a factory
        \"\"\"
        {1}s = {0}Factory.create_batch(5)
        self.assertEqual({0}.objects.count(), 5)

        self.assertEqual(len({1}s), 5)