Skip to content

Commit 224c47a

Browse files
Fixed four test issues within test code. (#7662)
### Description This PR fixed the three issues within the test code that could cause problems during CICD. Three issues: tests/test_pad_collation.py line 120: supposed to be assertEqual, but not assertTure? or it will always be true. tests/test_to_numpy.py line 74: Same as above. tests/test_auto3dseg.py line 370: typo? two same asserts next to each other. tests/test_compose.py line 719, 725, 727: Should be assertEqual instead of assertTrue ### Types of changes <!--- Put an `x` in all the boxes that apply, and remove the not applicable items --> - [x] Non-breaking change (fix or new feature that would not break existing functionality). - [ ] Breaking change (fix or new feature that would cause existing functionality to change). - [ ] New tests added to cover the changes. - [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`. - [x] Quick tests passed locally by running `./runtests.sh --quick --unittests --disttests`. - [ ] In-line docstrings updated. - [ ] Documentation updated, tested `make html` command in the `docs/` folder. Signed-off-by: Han Wang <freddie.wanah@gmail.com> Co-authored-by: YunLiu <55491388+KumoLiu@users.noreply.github.com>
1 parent ffd4454 commit 224c47a

4 files changed

Lines changed: 5 additions & 6 deletions

File tree

tests/test_auto3dseg.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,6 @@ def test_filename_case_analyzer(self):
367367
for batch_data in self.dataset:
368368
d = transform(batch_data[0])
369369
assert DataStatsKeys.BY_CASE_IMAGE_PATH in d
370-
assert DataStatsKeys.BY_CASE_IMAGE_PATH in d
371370

372371
def test_filename_case_analyzer_image_only(self):
373372
analyzer_image = FilenameStats("image", DataStatsKeys.BY_CASE_IMAGE_PATH)

tests/test_compose.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,15 @@ def test_compose_execute_equivalence_with_flags(self, flags, data, pipeline):
716716
for k in actual.keys():
717717
self.assertEqual(expected[k], actual[k])
718718
else:
719-
self.assertTrue(expected, actual)
719+
self.assertEqual(expected, actual)
720720

721721
p = deepcopy(pipeline)
722722
actual = execute_compose(execute_compose(data, p, start=0, end=cutoff, **flags), p, start=cutoff, **flags)
723723
if isinstance(actual, dict):
724724
for k in actual.keys():
725-
self.assertTrue(expected[k], actual[k])
725+
self.assertEqual(expected[k], actual[k])
726726
else:
727-
self.assertTrue(expected, actual)
727+
self.assertEqual(expected, actual)
728728

729729

730730
class TestComposeCallableInput(unittest.TestCase):

tests/test_pad_collation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_pad_collation(self, t_type, collate_method, transform):
117117
batch_inverse = BatchInverseTransform(dataset.transform, loader)
118118
for data in loader:
119119
output = batch_inverse(data)
120-
self.assertTrue(output[0]["image"].shape, (1, 10, 9))
120+
self.assertEqual(output[0]["image"].shape, (1, 10, 9))
121121

122122

123123
if __name__ == "__main__":

tests/test_to_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def test_list_tuple(self):
7171
assert_allclose(result, np.asarray(test_data), type_test=False)
7272
test_data = ((1, 2), (3, 4))
7373
result = ToNumpy(wrap_sequence=False)(test_data)
74-
self.assertTrue(type(result), tuple)
74+
self.assertIsInstance(result, tuple)
7575
assert_allclose(result, ((np.asarray(1), np.asarray(2)), (np.asarray(3), np.asarray(4))))
7676

7777
def test_single_value(self):

0 commit comments

Comments
 (0)