from tests.data import TypeOne


def test_saved_kwargs_on_generate():
    type_one = TypeOne()
    assert type_one._kwargs == {  # pylint: disable=protected-access
        'allow_none': False,
        'default': None,
        'name': None,
        'required': True
    }


def test_do_not_override_kwargs():
    type_one = TypeOne()
    type_one.save_kwargs({'new_value': 'test'})

    assert type_one._kwargs == {  # pylint: disable=protected-access
        'allow_none': False,
        'default': None,
        'name': None,
        'required': True
    }


def test_generate_with_default():
    default_value = 'Default value'
    type_one = TypeOne(default=default_value)

    assert type_one.value == default_value


def test_generate_with_default_function():
    default_value = 'Generated by function'
    type_one = TypeOne(default=lambda: default_value)

    assert type_one.value == default_value


def test_repr_of_generated_field():
    type_one = TypeOne()
    assert repr(type_one) == type_one.value
