# Path: tests/fixtures/build_fixture.py
# def build_fixture(modulename, data_variable_name='DATA'):
#     fixtures = deepcopy(
#         getattr(
#             importlib.import_module('..%s' % modulename, __name__),
#             data_variable_name,
#         )
#     )
# 
#     if 'submissions_xml' in fixtures:
#         # This fixture contains XML submissions, which apparently aren't used
#         # for anything yet; see
#         # `TestFormPackFixtures.test_xml_instances_loaded()`.
#         # Example XML fixture: tests/fixtures/favcolor/xml_instances.json
#         return fixtures
# 
#     title = fixtures.get('title')
# 
#     # separate the submissions from the schema
#     schemas = [dict(v) for v in fixtures['versions']]
#     submissions = []
#     for schema in schemas:
#         version = schema.get('version')
#         version_id_key = schema.get('version_id_key', '__version__')
#         for submission in schema.pop('submissions'):
#             submission.update({version_id_key: version})
#             submissions.append(submission)
#     return title, schemas, submissions


import json
import unittest
from formpack import FormPack
from .fixtures import build_fixture

        report = fp.autoreport()
        stats = report.get_stats(submissions, lang='french')

        assert stats.submissions_count == 4

        stats = [(str(repr(f)), n, d) for f, n, d in stats]

        expected = [
            (
                "<TextField name='restaurant_name' type='text'>",
                'nom du restaurant',
                {
                    'frequency': [
                        ('Taco Truck', 1),
                        ('Harvest', 1),
                        ('Wololo', 1),
                        ('Los pollos hermanos', 1),
                    ],
                    'not_provided': 0,
                    'percentage': [
                        ('Taco Truck', 25.00),
                        ('Harvest', 25.00),
                        ('Wololo', 25.00),
                        ('Los pollos hermanos', 25.00),
                    ],
                    'provided': 4,
                    'show_graph': False,
                    'total_count': 4,
                },

# Path: tests/fixtures/build_fixture.py
# def build_fixture(modulename, data_variable_name='DATA'):
#     fixtures = deepcopy(
#         getattr(
#             importlib.import_module('..%s' % modulename, __name__),
#             data_variable_name,
#         )
#     )
# 
#     if 'submissions_xml' in fixtures:
#         # This fixture contains XML submissions, which apparently aren't used
#         # for anything yet; see
#         # `TestFormPackFixtures.test_xml_instances_loaded()`.
#         # Example XML fixture: tests/fixtures/favcolor/xml_instances.json
#         return fixtures
# 
#     title = fixtures.get('title')
# 
#     # separate the submissions from the schema
#     schemas = [dict(v) for v in fixtures['versions']]
#     submissions = []
#     for schema in schemas:
#         version = schema.get('version')
#         version_id_key = schema.get('version_id_key', '__version__')
#         for submission in schema.pop('submissions'):
#             submission.update({version_id_key: version})
#             submissions.append(submission)
#     return title, schemas, submissions


# Path: tests/test_autoreport.py
import json
import unittest
from formpack import FormPack
from .fixtures import build_fixture


        report = fp.autoreport()
        stats = report.get_stats(submissions, lang='french')

        assert stats.submissions_count == 4

        stats = [(str(repr(f)), n, d) for f, n, d in stats]

        expected = [
            (
                "<TextField name='restaurant_name' type='text'>",
                'nom du restaurant',
                {
                    'frequency': [
                        ('Taco Truck', 1),
                        ('Harvest', 1),
                        ('Wololo', 1),
                        ('Los pollos hermanos', 1),
                    ],
                    'not_provided': 0,
                    'percentage': [
                        ('Taco Truck', 25.00),
                        ('Harvest', 25.00),
                        ('Wololo', 25.00),
                        ('Los pollos hermanos', 25.00),
                    ],
                    'provided': 4,
                    'show_graph': False,
                    'total_count': 4,
                },

            ),