def test_default_common_profile(*_):
    default = GenerateData()
    default.profile_name = 'Default Profile'
    default.template_name = 'Default Template'
    default.tuning_files = ['Default Tuning Files']
    default.tuning_data = {'Tuning Data': 'Default', 'Default': 'Tuning data'}

    common = GenerateData()
    common.profile_name = 'Common Profile'
    common.template_name = 'Common Template'
    common.tuning_files = ['Common Tuning Files']
    common.tuning_data = {'Tuning Data': 'Common', 'Common': 'Tuning data'}

    profile = GenerateData()
    profile.profile_name = 'Profile Profile'
    profile.template_name = 'Profile Template'
    profile.tuning_files = ['Profile Tuning Files']
    profile.tuning_data = {'Tuning Data': 'Profile', 'Profile': 'Tuning data'}

    expected = GenerateData()
    expected.profile_name = profile.profile_name
    expected.template_name = profile.template_name
    expected.tuning_files = [] + common.tuning_files + profile.tuning_files
    expected.tuning_data = {}
    expected.tuning_data.update(common.tuning_data)
    expected.tuning_data.update(profile.tuning_data)

    result = prioritize_generate_data(profile, common, default)

    assert expected == result
예제 #2
0
def test_neq_tuning_files(*_):
    data1 = GenerateData()
    data1.profile_name = 'Profile Name'
    data1.template_name = 'Template Name'
    data1.tuning_files = ['Tuning fil']
    data1.tuning_data = {'a': 1}

    data2 = GenerateData()
    data2.profile_name = 'Profile Name'
    data2.template_name = 'Template Name'
    data2.tuning_files = ['Tuning file']
    data2.tuning_data = {'a': 1}

    assert data1 != data2
def test_default(*_):
    default = GenerateData()
    default.profile_name = 'Default Profile'
    default.template_name = 'Default Template'
    default.tuning_files = ['Default Tuning Files']
    default.tuning_data = {'Tuning Data': 'Default', 'Default': 'Tuning data'}

    common = GenerateData()
    profile = GenerateData()

    result = prioritize_generate_data(profile, common, default)
    expected = default

    assert expected == result
def test_profile(*_):
    default = GenerateData()

    common = GenerateData()

    profile = GenerateData()
    profile.profile_name = 'Profile Profile'
    profile.template_name = 'Profile Template'
    profile.tuning_files = ['Profile Tuning Files']
    profile.tuning_data = {'Tuning Data': 'Profile', 'Profile': 'Tuning data'}

    expected = profile

    result = prioritize_generate_data(profile, common, default)

    assert expected == result
def test_common(*_):
    default = GenerateData()

    common = GenerateData()
    common.profile_name = 'Common Profile'
    common.template_name = 'Common Template'
    common.tuning_files = ['Common Tuning Files']
    common.tuning_data = {'Tuning Data': 'Common', 'Common': 'Tuning data'}

    profile = GenerateData()

    expected = common

    result = prioritize_generate_data(profile, common, default)

    assert expected == result
예제 #6
0
def test_data(*_):
    profile_file_data = {
        '_default': {
            'profile': 'Profile Name',
            'template': 'Template Name',
            'tuning_files': ['Tuning Files'],
            'tuning': {
                'a': 1,
            }
        }
    }

    result = extract_generate_data(profile_file_data)

    expected = GenerateData()
    expected.profile_name = 'Profile Name'
    expected.template_name = 'Template Name'
    expected.tuning_files = ['Tuning Files']
    expected.tuning_data = {'a': 1}

    assert expected == result