Coverage for tests/images/metadata/test_pixel_calibration.py: 100%
27 statements
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-31 11:24 +0000
« prev ^ index » next coverage.py v7.6.10, created at 2025-01-31 11:24 +0000
1from qubalab.images.metadata.pixel_calibration import PixelLength, PixelCalibration
4def test_default_pixel_length():
5 pixel_length = PixelLength()
7 is_default = pixel_length.is_default()
9 assert is_default
12def test_default_values_of_pixel_length():
13 expected_pixel_length = PixelLength(1.0, 'pixels')
15 pixel_length = PixelLength()
17 assert expected_pixel_length == pixel_length
20def test_length_and_unit_of_pixel_length_different():
21 pixel_length = PixelLength()
22 pixel_length_microns = PixelLength.create_microns(0.25)
24 assert pixel_length != pixel_length_microns
27def test_length():
28 length = 0.25
30 pixel_length = PixelLength.create_microns(length)
32 assert pixel_length.length == length
35def test_unit():
36 unit = 'micrometer'
38 pixel_length = PixelLength.create_microns(0)
40 assert pixel_length.unit == unit
43def test_default_pixel_calibration_not_calibrated():
44 pixel_calibration = PixelCalibration()
46 assert not pixel_calibration.is_calibrated()
49def test_default_pixel_calibration_calibrated():
50 pixel_calibration = PixelCalibration(length_x=PixelLength.create_microns(0.25))
52 assert pixel_calibration.is_calibrated()