Skip to content

Some tweaks to the testing. Make SLS SXTM files open read only #171

Some tweaks to the testing. Make SLS SXTM files open read only

Some tweaks to the testing. Make SLS SXTM files open read only #171

GitHub Actions / Unit Test Results failed Dec 8, 2023 in 0s

2 fail, 289 pass in 59m 48s

       5 files  ±0         5 suites  ±0   59m 48s ⏱️ -32s
   291 tests ±0     289 ✔️ ±0  0 💤 ±0  2 ±0 
1 455 runs  ±0  1 451 ✔️ ±0  0 💤 ±0  4 ±0 

Results for commit 6ad0502. ± Comparison against earlier commit eee60d9.

Annotations

Check warning on line 0 in tests.Stoner.Image.test_core

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results

2 out of 5 runs failed: test_attrs (tests.Stoner.Image.test_core)

artifacts/Unit Test Results (Python 3.10)/pytest.xml
artifacts/Unit Test Results (Python 3.11)/pytest.xml
Raw output
def test_attrs():
        attrs = [x for x in dir(ImageArray([])) if not x.startswith("_")]
>       assert len(attrs) == _expected(), "Length of ImageArray dir failed. {}".format(len(attrs))
E       AssertionError: Length of ImageArray dir failed. 1089
E       assert 1089 == 1090
E        +  where 1089 = len(['AffineTransform', 'BRIEF', 'CCW', 'CENSURE', 'CW', 'Cascade', ...])
E        +  and   1090 = _expected()

/home/runner/work/Stoner-PythonCode/Stoner-PythonCode/tests/Stoner/Image/test_core.py:346: AssertionError

Check warning on line 0 in tests.Stoner.Image.test_core

See this annotation in the file changed.

@github-actions github-actions / Unit Test Results

2 out of 5 runs failed: test_methods (tests.Stoner.Image.test_core)

artifacts/Unit Test Results (Python 3.10)/pytest.xml
artifacts/Unit Test Results (Python 3.11)/pytest.xml
Raw output
def test_methods():
        b = np.arange(12).reshape(3, 4)
        ifi = ImageFile(b)
        ifi.asfloat(normalise=False, clip_negative=False)  # convert in place
        assert ifi.image.dtype.kind == "f"
        assert np.max(ifi) == 11.0
        ifi.image == ifi.image * 5
        ifi.rescale_intensity()
        assert np.allclose(ifi.image, np.linspace(0, 1, 12).reshape(3, 4))
        ifi.crop(0, 3, 0, None)
        assert ifi.shape == (3, 3)  # check crop is forced to overwrite ifi despite shape change
        datadir = path.join(__home__, "..", "sample-data")
        image = ImageFile(path.join(datadir, "kermit.png")).asfloat(normalise=False)
        i2 = image.clone.crop(5, _=True)
        assert i2.shape == (469, 349), "Failed to trim box by integer"
        i2 = image.clone.crop(0.25, _=True)
        assert i2.shape == (269, 269), "Failed to trim box by float"
        i2 = image.clone
        i2.crop([0.1, 0.2, 0.05, 0.1], _=True)
        assert i2.shape == (24, 36), "Failed to trim box by sequence of floats"
        assert image.aspect == pytest.approx(0.7494780793), "Aspect ratio failed"
        assert image.centre == (239.5, 179.5), "Failed to read image.centre"
        i2 = image.CW
        assert i2.shape == (359, 479), "Failed to rotate clockwise"
        i3 = i2.CCW
        assert i3.shape == (479, 359), "Failed to rotate counter-clockwise"
        i3 = i2.flip_h
        assert np.all(i3[:, 0] == i2[:, -1]), "Flip Horizontal failed"
        i3 = i2.flip_v
        assert np.all(i3[0, :] == i2[-1, :]), "Flip Horizontal failed"
        i2 = image.clone
        i3 = i2 - 127
        assert i3.mean() == pytest.approx(33940.72596111909, rel=1e-2), "Subtract integer failed."
        with pytest.raises(TypeError):
            i2 - "Gobble"
        attrs = [x for x in dir(i2) if not x.startswith("_")]
>       assert len(attrs) == _expected() + 4, "Length of ImageFile dir failed. {}:{}".format(expected, len(attrs))
E       NameError: name 'expected' is not defined

/home/runner/work/Stoner-PythonCode/Stoner-PythonCode/tests/Stoner/Image/test_core.py:425: NameError