DiamondLightSource / DiamondLightSource/pyplanemono_minimal
Tests are broken
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
When I run the tests using `python -m unittest discover -v tests`:
```
No arguments given, plane at origin with normal (0, 0, 1) initialised! Tread carefully!
test_add (test_geometry.TestVector3D) ... ok
test_angle (test_geometry.TestVector3D) ... ok
test_copy (test_geometry.TestVector3D) ... ok
test_cross_product (test_geometry.TestVector3D) ... ERROR
test_deepcopy (test_geometry.TestVector3D) ... ok
test_dot_product (test_geometry.TestVector3D) ... ok
test_equality (test_geometry.TestVector3D) ... ok
test_get_component (test_geometry.TestVector3D) ... ok
test_hash (test_geometry.TestVector3D) ... /scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/geometry/geometry.py:333: DeprecationWarning: tostring() is deprecated. Use tobytes() instead.
return hash(self._vector.tostring())
ok
test_inequality (test_geometry.TestVector3D) ... ok
test_iterator (test_geometry.TestVector3D) ... ok
test_length (test_geometry.TestVector3D) ... ok
test_magnitude (test_geometry.TestVector3D) ... ok
test_negative (test_geometry.TestVector3D) ... ok
test_normalize (test_geometry.TestVector3D) ... ok
test_rotate (test_geometry.TestVector3D) ... FAIL
test_rotate_x (test_geometry.TestVector3D) ... FAIL
test_rotate_y (test_geometry.TestVector3D) ... FAIL
test_rotate_z (test_geometry.TestVector3D) ... FAIL
test_set_component (test_geometry.TestVector3D) ... ok
test_subtract (test_geometry.TestVector3D) ... ok
test_borders (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ERROR
test_cff (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_compute_corners (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_diffract (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
Ray of index 0 does not intersect grating, tread with caution!
ERROR
test_dimensions (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_energy (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_line_density (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_order (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
order set!
ok
test_reflect (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
Ray of index 0 does not intersect grating, tread with caution!
FAIL
test_set_angles (test_grating.TestGrating) ... 2400 1 600 2 5.166008268050012e-10
ok
test_compute_corners (test_mirror.TestPlaneMirror) ... ok
test_reflect (test_mirror.TestPlaneMirror) ... Ray of index 0 does not intersect mirror, tread with caution!
FAIL
test_set_dimensions (test_mirror.TestPlaneMirror) ... ok
test_set_normal (test_mirror.TestPlaneMirror) ... ERROR
test_set_offsets (test_mirror.TestPlaneMirror) ... ERROR
test_set_position (test_mirror.TestPlaneMirror) ... ERROR
test_energy (test_pgm.TestPGM) ... ERROR
test_generate_rays (test_pgm.TestPGM) ... ERROR
test_grating (test_pgm.TestPGM) ... ERROR
test_mirror (test_pgm.TestPGM) ... ERROR
test_propagate (test_pgm.TestPGM) ... ERROR
test_set_theta (test_pgm.TestPGM) ... ERROR
======================================================================
ERROR: test_cross_product (test_geometry.TestVector3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_geometry.py", line 35, in test_cross_product
result = self.vector / other
TypeError: unsupported operand type(s) for /: 'Vector3D' and 'Vector3D'
======================================================================
ERROR: test_borders (test_grating.TestGrating)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_grating.py", line 40, in test_borders
self.grating.borders = borders
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 251, in borders
raise ValueError("Expected exactly 1D array of length 4 for borders")
ValueError: Expected exactly 1D array of length 4 for borders
======================================================================
ERROR: test_diffract (test_grating.TestGrating)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_grating.py", line 58, in test_diffract
diffracted_rays = self.grating.diffract(ray1, ray2)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 383, in diffract
diff_ray = self.reflect(ray)[0]
IndexError: list index out of range
======================================================================
ERROR: test_set_normal (test_mirror.TestPlaneMirror)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_mirror.py", line 20, in test_set_normal
self.assertEqual(self.mirror.plane.normal, normal)
File "/scratch/opt/mf/envs/davidia/lib/python3.10/unittest/case.py", line 845, in assertEqual
assertion_func(first, second, msg=msg)
File "/scratch/opt/mf/envs/davidia/lib/python3.10/unittest/case.py", line 835, in _baseAssertEqual
if not first == second:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
======================================================================
ERROR: test_set_offsets (test_mirror.TestPlaneMirror)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_mirror.py", line 34, in test_set_offsets
self.mirror.set_offsets(voffset, hoffset, axis_voffset, axis_hoffset)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/mirror.py", line 390, in set_offsets
self.voffset(voffset)
TypeError: 'int' object is not callable
======================================================================
ERROR: test_set_position (test_mirror.TestPlaneMirror)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_mirror.py", line 14, in test_set_position
self.assertEqual(self.mirror.plane.position, position)
File "/scratch/opt/mf/envs/davidia/lib/python3.10/unittest/case.py", line 845, in assertEqual
assertion_func(first, second, msg=msg)
File "/scratch/opt/mf/envs/davidia/lib/python3.10/unittest/case.py", line 835, in _baseAssertEqual
if not first == second:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
======================================================================
ERROR: test_energy (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
ERROR: test_generate_rays (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
ERROR: test_grating (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
ERROR: test_mirror (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
ERROR: test_propagate (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
ERROR: test_set_theta (test_pgm.TestPGM)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_pgm.py", line 8, in setUp
self.pgm = PGM()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/pgm.py", line 87, in __init__
self._grating = Grating(**grating_kwargs)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 112, in __init__
_,_ = self.compute_angles()
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 331, in compute_angles
wavelength = self.energy_to_wavelength(self.energy)
File "/scratch/work/3rd/pyplanemono_minimal.git/pyplanemono_minimal/elements/grating.py", line 395, in energy_to_wavelength
return h*c/(e*energy)
TypeError: unsupported operand type(s) for *: 'float' and 'NoneType'
======================================================================
FAIL: test_rotate (test_geometry.TestVector3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_geometry.py", line 125, in test_rotate
self.assertAlmostEqual(result.x, 1.0)
AssertionError: 1.1951848383630999 != 1.0 within 7 places (0.19518483836309986 difference)
======================================================================
FAIL: test_rotate_x (test_geometry.TestVector3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_geometry.py", line 134, in test_rotate_x
self.assertAlmostEqual(result.y, -0.3660254037844386)
AssertionError: 0.3168885079681365 != -0.3660254037844386 within 7 places (0.6829139117525751 difference)
======================================================================
FAIL: test_rotate_y (test_geometry.TestVector3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_geometry.py", line 141, in test_rotate_y
self.assertAlmostEqual(result.x, 2.232050807568877)
AssertionError: 2.3158591777029818 != 2.232050807568877 within 7 places (0.08380837013410458 difference)
======================================================================
FAIL: test_rotate_z (test_geometry.TestVector3D)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_geometry.py", line 149, in test_rotate_z
self.assertAlmostEqual(result.x, -0.3660254037844386)
AssertionError: -0.08126851531803325 != -0.3660254037844386 within 7 places (0.28475688846640534 difference)
======================================================================
FAIL: test_reflect (test_grating.TestGrating)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_grating.py", line 66, in test_reflect
self.assertEqual(len(reflected_rays), 2)
AssertionError: 1 != 2
======================================================================
FAIL: test_reflect (test_mirror.TestPlaneMirror)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/scratch/work/3rd/pyplanemono_minimal.git/tests/test_mirror.py", line 50, in test_reflect
self.assertEqual(len(reflected_rays), 2)
AssertionError: 1 != 2
----------------------------------------------------------------------
Ran 43 tests in 0.007s
FAILED (failures=6, errors=12)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.