Skip to content

Commit

Permalink
Rename test DCI class to avoid pickup by pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Oct 3, 2023
1 parent 4267e54 commit b5ce3c5
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/unit/utils_test/test_core_GenericDataChunkIterator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
TQDM_INSTALLED = False


class TestPickleableNumpyArrayDataChunkIterator(GenericDataChunkIterator):
class PickleableNumpyArrayDataChunkIterator(GenericDataChunkIterator):
def __init__(self, array: np.ndarray, **kwargs):
self.array = array
self._kwargs = kwargs
Expand All @@ -41,7 +41,7 @@ def _to_dict(self) -> dict:
@staticmethod
def _from_dict(dictionary: dict) -> Callable:
array = pickle.loads(dictionary["array"])
return TestPickleableNumpyArrayDataChunkIterator(array=array, **dictionary["kwargs"])
return PickleableNumpyArrayDataChunkIterator(array=array, **dictionary["kwargs"])


class GenericDataChunkIteratorTests(TestCase):
Expand Down Expand Up @@ -428,10 +428,10 @@ def test_tqdm_not_installed(self):
self.assertFalse(dci.display_progress)

def test_pickle(self):
pre_dump_iterator = TestPickleableNumpyArrayDataChunkIterator(array=self.test_array)
pre_dump_iterator = PickleableNumpyArrayDataChunkIterator(array=self.test_array)
post_dump_iterator = pickle.loads(pickle.dumps(pre_dump_iterator))

assert isinstance(post_dump_iterator, TestPickleableNumpyArrayDataChunkIterator)
assert isinstance(post_dump_iterator, PickleableNumpyArrayDataChunkIterator)
assert post_dump_iterator.chunk_shape == pre_dump_iterator.chunk_shape
assert post_dump_iterator.buffer_shape == pre_dump_iterator.buffer_shape
assert_array_equal(post_dump_iterator.array, pre_dump_iterator.array)

0 comments on commit b5ce3c5

Please sign in to comment.