Skip to content

Commit 556e141

Browse files
committed
test: add starting point and last point for test.
1 parent 4369cc2 commit 556e141

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed
File renamed without changes.

tests/test_load_image.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os
22
import shutil
33
from pathlib import Path
4+
from unittest.mock import Mock
45

5-
import numpy as np
66
import pytest
77

88
from diffpy.srxplanar.loadimage import LoadImage
@@ -33,24 +33,23 @@ def test_load_image(file_name, user_filesystem):
3333
# These values were obtained from docs/examples/data/KFe2As2-00838.tif
3434
expected_mean = 2595.7087
3535
expected_shape = (2048, 2048)
36-
expected_first_point = ?
37-
expected_last_point = ?
36+
expected_first_point = 0
37+
expected_last_point = 0
3838

3939
# locate source example file inside project docs
40-
source_file = PROJECT_ROOT / "docs" / "examples" / "data" / "KFe2As2-00838.tif"
40+
source_file = (
41+
PROJECT_ROOT / "docs" / "examples" / "data" / "KFe2As2-00838.tif"
42+
)
4143
shutil.copy(source_file, cwd_dir / "KFe2As2-00838.tif")
4244
shutil.copy(source_file, home_dir / "KFe2As2-00838.tif")
4345

4446
try:
45-
cfg = type(
46-
"Cfg", (), {"fliphorizontal": False, "flipvertical": False}
47-
)()
48-
loader = LoadImage(cfg)
47+
loader = LoadImage(Mock(fliphorizontal=False, flipvertical=False))
4948
actual = loader.load_image(file_name)
5049
assert actual.shape == expected_shape
5150
assert actual.mean() == expected_mean
52-
assert actual[0] == expected_first_point
53-
assert actual[-1] == expected_last_point
51+
assert actual[0][0] == expected_first_point
52+
assert actual[-1][-1] == expected_last_point
5453
except FileNotFoundError:
5554
pytest.raises(
5655
FileNotFoundError,

0 commit comments

Comments
 (0)