From 43914d42049724f0841ff5818fda005f475a1ecd Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Tue, 19 Mar 2019 08:41:11 -0500 Subject: [PATCH] Re-correcting direction and updating _Position tests. --- include/openmc/plot.h | 2 +- tests/unit_tests/test_capi.py | 20 +++++--------------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/include/openmc/plot.h b/include/openmc/plot.h index 73bcd1d361..2752add9cf 100644 --- a/include/openmc/plot.h +++ b/include/openmc/plot.h @@ -145,7 +145,7 @@ T PlotBase::get_map() const { xyz[out_i] = origin_[out_i] + width_[1] / 2. - out_pixel / 2.; // arbitrary direction - Direction dir = {0.5, 0.5, 0.5}; + Direction dir = {0.7071, 0.7071, 0.0}; #pragma omp parallel { diff --git a/tests/unit_tests/test_capi.py b/tests/unit_tests/test_capi.py index dc3812fe0d..be88072d9f 100644 --- a/tests/unit_tests/test_capi.py +++ b/tests/unit_tests/test_capi.py @@ -442,22 +442,12 @@ def test_property_map(capi_init): def test_position(capi_init): - pos = openmc.capi.plot._Position(1.0, 1.0, 1.0) + pos = openmc.capi.plot._Position(1.0, 2.0, 3.0) - assert pos[0] == 1.0 - assert pos[1] == 1.0 - assert pos[2] == 1.0 + assert tuple(pos) == (1.0, 2.0, 3.0) pos[0] = 1.3 - pos[1] = 1.3 - pos[2] = 1.3 + pos[1] = 2.3 + pos[2] = 3.3 - assert pos[0] == 1.3 - assert pos[1] == 1.3 - assert pos[2] == 1.3 - - with pytest.raises(IndexError) as e: - pos[3] = 1.3 - - with pytest.raises(IndexError) as e: - pos[-1] = 1.3 + assert tuple(pos) == (1.3, 2.3, 3.3)