Skip to content

Commit 81fb6f0

Browse files
committed
Updated uniform plugin tests to use load_dict
1 parent b34d3af commit 81fb6f0

File tree

1 file changed

+11
-16
lines changed

1 file changed

+11
-16
lines changed

src/spectra/tests/test_uniform.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@
55

66

77
def make_spectrum(value=None, lambda_min=None, lambda_max=None):
8-
from mitsuba.core.xml import load_string
8+
from mitsuba.core.xml import load_dict
9+
10+
dict_spectrum = {"type": "uniform"}
11+
12+
if value is not None:
13+
dict_spectrum["value"] = value
14+
if lambda_min is not None:
15+
dict_spectrum["lambda_min"] = lambda_min
16+
if lambda_max is not None:
17+
dict_spectrum["lambda_max"] = lambda_max
918

10-
xml_value = f"""<float name="value" value="{value}"/>""" \
11-
if value is not None else ""
12-
xml_lambda_min = f"""<float name="lambda_min" value="{lambda_min}"/>""" \
13-
if lambda_min is not None else ""
14-
xml_lambda_max = f"""<float name="lambda_max" value="{lambda_max}"/>""" \
15-
if lambda_max is not None else ""
16-
17-
xml_spectrum = f"""
18-
<spectrum version="2.0.0" type="uniform">
19-
{xml_value}
20-
{xml_lambda_min}
21-
{xml_lambda_max}
22-
</spectrum>
23-
"""
24-
return load_string(xml_spectrum)
19+
return load_dict(dict_spectrum)
2520

2621

2722
def test_construct(variant_scalar_spectral):

0 commit comments

Comments
 (0)