Skip to content

Commit 8ddbe61

Browse files
committed
TST: fixed some unit tests
1 parent 6d27627 commit 8ddbe61

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

pyxrf/core/tests/test_map_processing.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ def test_dask_client_create(tmpdir):
4747

4848
# Set the number of workers to some strange number (11 is unusual)
4949
# (pass another kwarg in addition to default)
50-
client = dask_client_create(n_workers=11)
50+
n_workers_set = 11
51+
client = dask_client_create(n_workers=n_workers_set)
5152
n_workers = len(client.scheduler_info()["workers"])
52-
assert n_workers == 11, "The number of workers was set incorrectly"
53+
assert n_workers == n_workers_set, "The number of workers was set incorrectly"
5354
client.close()
5455

5556
assert not os.path.exists(dask_worker_space_path), "Temporary directory was created in the current directory"

pyxrf/core/tests/test_quant_analysis.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,11 @@ def test_get_quant_fluor_data_dict():
347347
), "Generated object contains emission lines that are different from expected"
348348

349349
mass_sum = sum([_["density"] for _ in quant_fluor_data_dict["element_lines"].values()])
350-
assert (
351-
mass_sum == mass_sum_expected
352-
), "The total mass (density) of the components is different from expected"
350+
npt.assert_almost_equal(
351+
mass_sum,
352+
mass_sum_expected,
353+
err_msg="The total mass (density) of the components is different from expected"
354+
)
353355

354356

355357
def gen_xrf_map_dict(nx=10, ny=5, elines=["S_K", "Au_M", "Fe_K"]):

pyxrf/model/tests/test_hdf5_file_operations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _prepare_raw_dataset(N=5, M=10, K=4096):
2323
pos_data = np.zeros(shape=[2, N, M])
2424
pos_data[0, :, :] = np.broadcast_to(np.linspace(1, 1 + (M - 1) * 0.1, M), shape=[N, M])
2525
pos_data[1, :, :] = np.broadcast_to(
26-
np.reshape(np.linspace(5, 5 + (N - 1) * 0.2, N), newshape=[N, 1]), shape=[N, M]
26+
np.reshape(np.linspace(5, 5 + (N - 1) * 0.2, N), shape=[N, 1]), shape=[N, M]
2727
)
2828

2929
data = {

0 commit comments

Comments
 (0)