# Path: magnate/savegame/base_types.py
# def type_name(value):
# def _generic_types_validator(type_enum, value):
# def load_base_types(datadir):
# def init_base_types(datadir):
# DATA_TYPES_SCHEMA = v.Schema({'version': '0.1',
#                               'types': {type_name: [str]}, },
#                              required=True)
# 
# Path: magnate/savegame/data_def.py
# BASE_SCHEMA = None
# SYSTEM_SCHEMA = None
#     SYSTEM_SCHEMA = v.Schema(v.All(system_structure,
#                                    known_celestial))
#     BASE_SCHEMA = v.Schema(v.All(base_structure,
#                                  volume_or_storage))
# def known_celestial(data):
# def volume_or_storage(data):
# def _define_schemas(datadir):
# def load_data_definitions(datadir):


import copy
import os
import pytest
import voluptuous
import voluptuous.error
from voluptuous.humanize import validate_with_humanized_errors as v_validate
from magnate.savegame import base_types
from magnate.savegame import data_def



pytestmark = pytest.mark.usefixtures('clean_context')


@pytest.fixture
def setup_base_types(datadir, clean_context):
    base_types.init_base_types(datadir)
    yield


# Tests for voluptuous validators
class TestValidators:
    @pytest.mark.parametrize("locations", [{'celestial': 'Venus'},
                                           # Fine to have two locations on the same celestial
                                           {'celestial': 'Mercury'},
                                          ])
    def test_known_celestial(self, locations):
        data = {'systems': [
                   {'celestials': [
                        {'name': 'Mercury'},
                        {'name': 'Venus'},
                    ],
                    'locations': [
                        {'celestial': 'Mercury'},
                    ],
                },
               ]}
        data['systems'][0]['locations'].append(locations)

# Path: magnate/savegame/base_types.py
# def type_name(value):
# def _generic_types_validator(type_enum, value):
# def load_base_types(datadir):
# def init_base_types(datadir):
# DATA_TYPES_SCHEMA = v.Schema({'version': '0.1',
#                               'types': {type_name: [str]}, },
#                              required=True)
# 
# Path: magnate/savegame/data_def.py
# BASE_SCHEMA = None
# SYSTEM_SCHEMA = None
#     SYSTEM_SCHEMA = v.Schema(v.All(system_structure,
#                                    known_celestial))
#     BASE_SCHEMA = v.Schema(v.All(base_structure,
#                                  volume_or_storage))
# def known_celestial(data):
# def volume_or_storage(data):
# def _define_schemas(datadir):
# def load_data_definitions(datadir):


# Path: tests/units/savegame/test_data_def.py
import copy
import os
import pytest
import voluptuous
import voluptuous.error
from voluptuous.humanize import validate_with_humanized_errors as v_validate
from magnate.savegame import base_types
from magnate.savegame import data_def




pytestmark = pytest.mark.usefixtures('clean_context')


@pytest.fixture
def setup_base_types(datadir, clean_context):
    base_types.init_base_types(datadir)
    yield


# Tests for voluptuous validators
class TestValidators:
    @pytest.mark.parametrize("locations", [{'celestial': 'Venus'},
                                           # Fine to have two locations on the same celestial
                                           {'celestial': 'Mercury'},
                                          ])
    def test_known_celestial(self, locations):
        data = {'systems': [
                   {'celestials': [
                        {'name': 'Mercury'},
                        {'name': 'Venus'},
                    ],
                    'locations': [
                        {'celestial': 'Mercury'},
                    ],
                },
               ]}
        data['systems'][0]['locations'].append(locations)

        assert data_def.known_celestial(data) == data