Skip to content

Commit

Permalink
feat: updates unit tests for unpredicatable list ordering
Browse files Browse the repository at this point in the history
  • Loading branch information
jtyoung84 committed Mar 17, 2024
1 parent 3561005 commit 9302f31
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions tests/test_ephys_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,11 @@ def test_get_read_blocks(self):
"stream_name": "Record Node 101#Neuropix-PXI-100.ProbeC",
},
]
self.assertEqual(expected_read_blocks, read_blocks_repr)
expected_scaled_read_blocks_str = set(
[json.dumps(o) for o in expected_read_blocks]
)
read_blocks_repr_str = set([json.dumps(o) for o in read_blocks_repr])
self.assertEqual(expected_scaled_read_blocks_str, read_blocks_repr_str)

def test_scale_read_blocks(self):
"""Tests _scale_read_blocks method"""
Expand Down Expand Up @@ -261,8 +265,15 @@ def test_scale_read_blocks(self):
"stream_name": "Record Node 101#Neuropix-PXI-100.ProbeC",
},
]

self.assertEqual(expected_scaled_read_blocks, scaled_read_blocks_repr)
expected_scaled_read_blocks_str = set(
[json.dumps(o) for o in expected_scaled_read_blocks]
)
scaled_read_blocks_repr_str = set(
[json.dumps(o) for o in scaled_read_blocks_repr]
)
self.assertEqual(
expected_scaled_read_blocks_str, scaled_read_blocks_repr_str
)

def test_get_streams_to_clip(self):
"""Tests _get_streams_to_clip method"""
Expand Down Expand Up @@ -352,7 +363,11 @@ def base_path(num: int) -> Path:
"data": (100, 384),
},
]
self.assertEqual(expected_output, streams_to_clip_just_shape)
expected_output_str = set([json.dumps(o) for o in expected_output])
streams_to_clip_just_shape_str = set(
[json.dumps(o) for o in streams_to_clip_just_shape]
)
self.assertEqual(expected_output_str, streams_to_clip_just_shape_str)

@patch("shutil.copytree")
@patch("shutil.ignore_patterns")
Expand Down Expand Up @@ -904,7 +919,8 @@ def test_compress_and_write_read_blocks(
),
n_jobs=1,
),
]
],
any_order=True,
)

@patch("os.cpu_count")
Expand Down Expand Up @@ -1014,7 +1030,8 @@ def test_compress_raw_data(
call("Finished clipping source data."),
call("Compressing source data."),
call("Finished compressing source data."),
]
],
any_order=True,
)
self.assertEqual(1, len(mock_copy_and_clip_data.mock_calls))
# More granularity can be added in the future. For now, we just compare
Expand Down

0 comments on commit 9302f31

Please sign in to comment.