mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Remove config_section parameter
Just always take 'profile'. We don't need to test with anything else. Just adjust the data to it. Contributes to issue CURA-5929.
This commit is contained in:
parent
e18ea4bca4
commit
7e87a303cb
1 changed files with 9 additions and 14 deletions
|
@ -41,7 +41,6 @@ test_prepareLocalsData = [
|
|||
"infill_density": "30"
|
||||
}
|
||||
},
|
||||
"profile", # Config section.
|
||||
{ # Defaults.
|
||||
"layer_height": "0.1",
|
||||
"infill_density": "20",
|
||||
|
@ -54,7 +53,6 @@ test_prepareLocalsData = [
|
|||
{
|
||||
}
|
||||
},
|
||||
"profile", # Config section.
|
||||
{ # Defaults.
|
||||
}
|
||||
),
|
||||
|
@ -64,7 +62,6 @@ test_prepareLocalsData = [
|
|||
{
|
||||
}
|
||||
},
|
||||
"profile", # Config section.
|
||||
{ # Defaults.
|
||||
"foo": "bar",
|
||||
"boo": "far"
|
||||
|
@ -81,25 +78,24 @@ test_prepareLocalsData = [
|
|||
"foo": "baz" #Not the same as in some_other_name
|
||||
}
|
||||
},
|
||||
"profile", # Config section.
|
||||
{ # Defaults.
|
||||
"foo": "bla"
|
||||
}
|
||||
)
|
||||
]
|
||||
|
||||
@pytest.mark.parametrize("parser_data, config_section, defaults", test_prepareLocalsData)
|
||||
def test_prepareLocals(legacy_profile_reader, parser_data, config_section, defaults):
|
||||
@pytest.mark.parametrize("parser_data, defaults", test_prepareLocalsData)
|
||||
def test_prepareLocals(legacy_profile_reader, parser_data, defaults):
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read_dict(parser_data)
|
||||
|
||||
output = legacy_profile_reader.prepareLocals(parser, config_section, defaults)
|
||||
output = legacy_profile_reader.prepareLocals(parser, "profile", defaults)
|
||||
|
||||
assert set(defaults.keys()) <= set(output.keys()) # All defaults must be in there.
|
||||
assert set(parser_data[config_section]) <= set(output.keys()) # All overwritten values must be in there.
|
||||
assert set(parser_data["profile"]) <= set(output.keys()) # All overwritten values must be in there.
|
||||
for key in output:
|
||||
if key in parser_data[config_section]:
|
||||
assert output[key] == parser_data[config_section][key] # If overwritten, must be the overwritten value.
|
||||
if key in parser_data["profile"]:
|
||||
assert output[key] == parser_data["profile"][key] # If overwritten, must be the overwritten value.
|
||||
else:
|
||||
assert output[key] == defaults[key] # Otherwise must be equal to the default.
|
||||
|
||||
|
@ -111,7 +107,6 @@ test_prepareLocalsNoSectionErrorData = [
|
|||
"foo": "bar"
|
||||
},
|
||||
},
|
||||
"profile", # Config section.
|
||||
{ # Defaults.
|
||||
"foo": "baz"
|
||||
}
|
||||
|
@ -119,10 +114,10 @@ test_prepareLocalsNoSectionErrorData = [
|
|||
]
|
||||
|
||||
## Test cases where a key error is expected.
|
||||
@pytest.mark.parametrize("parser_data, config_section, defaults", test_prepareLocalsNoSectionErrorData)
|
||||
def test_prepareLocalsNoSectionError(legacy_profile_reader, parser_data, config_section, defaults):
|
||||
@pytest.mark.parametrize("parser_data, defaults", test_prepareLocalsNoSectionErrorData)
|
||||
def test_prepareLocalsNoSectionError(legacy_profile_reader, parser_data, defaults):
|
||||
parser = configparser.ConfigParser()
|
||||
parser.read_dict(parser_data)
|
||||
|
||||
with pytest.raises(configparser.NoSectionError):
|
||||
legacy_profile_reader.prepareLocals(parser, config_section, defaults)
|
||||
legacy_profile_reader.prepareLocals(parser, "profile", defaults)
|
Loading…
Add table
Add a link
Reference in a new issue