diff --git a/peppy/_version.py b/peppy/_version.py index f0b083c2..da532ef5 100644 --- a/peppy/_version.py +++ b/peppy/_version.py @@ -1 +1 @@ -__version__ = "0.40.0a2" +__version__ = "0.40.0a3" diff --git a/peppy/project.py b/peppy/project.py index 3310c3a1..090d37ed 100644 --- a/peppy/project.py +++ b/peppy/project.py @@ -226,7 +226,7 @@ def from_dict(self, pep_dictionary: dict) -> "Project": def to_dict( self, - expand: bool = False, + # expand: bool = False, # expand was used to expand paths. This functionality was removed, because of attmapp extended: bool = False, orient: Literal[ "dict", "list", "series", "split", "tight", "records", "index" @@ -1397,6 +1397,7 @@ def __delitem__(self, key): def __repr__(self): return str(self) + # # pickle now is impossible, because it's impossible to initialize Project class without using actual files # def __reduce__(self): # return (self.__class__,) diff --git a/peppy/sample.py b/peppy/sample.py index eac6bc45..61dcd38d 100644 --- a/peppy/sample.py +++ b/peppy/sample.py @@ -307,10 +307,9 @@ def __reduce__(self): return ( self.__class__, (pd.Series(self.to_dict()),), - # (self.as_series(),), - (None, {}), - iter([]), - iter({PRJ_REF: self[PRJ_REF]}.items()), + # (None, {}), + # iter([]), + # iter({PRJ_REF: self[PRJ_REF]}.items()), ) def __len__(self): diff --git a/tests/smoketests/test_Sample.py b/tests/smoketests/test_Sample.py index 1fdf89f0..a9a933bd 100644 --- a/tests/smoketests/test_Sample.py +++ b/tests/smoketests/test_Sample.py @@ -66,3 +66,14 @@ def test_sheet_dict_excludes_private_attrs(self, example_pep_cfg_path): p = Project(cfg=example_pep_cfg_path) for sample in p.samples: assert len(sample.get_sheet_dict()) == len(p.sample_table.columns) + + @pytest.mark.parametrize("example_pep_cfg_path", ["basic"], indirect=True) + def test_pickle_in_samples(self, example_pep_cfg_path): + import pickle + + p = Project(cfg=example_pep_cfg_path) + for sample in p.samples: + pickled_data = pickle.dumps(sample) + unpickled_sample = pickle.loads(pickled_data) + + assert sample.to_dict() == unpickled_sample.to_dict() diff --git a/tests/test_Project.py b/tests/test_Project.py index 9833c0cb..bf073918 100644 --- a/tests/test_Project.py +++ b/tests/test_Project.py @@ -393,10 +393,12 @@ def test_peppy_initializes_samples_with_correct_attributes( p = Project(example_pep_cfg_path, sample_table_index="sample") assert all([expected_attribute in sample for sample in p.samples]) + @pytest.mark.skip( + "skipping this test, because this functionality is unavailable now" + ) @pytest.mark.parametrize("example_pep_cfg_path", ["basic", "imply"], indirect=True) def test_correct_pickle(self, example_pep_cfg_path): proj = Project(example_pep_cfg_path) - pickled_data = pickle.dumps(proj) unpickled_project = pickle.loads(pickled_data)