From a616445a242bea7fc690a453deed16786aefa089 Mon Sep 17 00:00:00 2001 From: Timothy Shields Date: Fri, 24 Jan 2025 12:59:14 -0600 Subject: [PATCH] Make uberjob.Plan and various internal atom objects picklable --- src/uberjob/_util/__init__.py | 4 ++-- tests/test_atoms.py | 8 ++++---- tests/test_plan.py | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/uberjob/_util/__init__.py b/src/uberjob/_util/__init__.py index 74c3213..7f78808 100644 --- a/src/uberjob/_util/__init__.py +++ b/src/uberjob/_util/__init__.py @@ -39,7 +39,7 @@ def is_ipython(): class OmittedType: def __new__(cls): return Omitted - + def __getnewargs__(self): return () @@ -53,7 +53,7 @@ def __repr__(self): class MissingType: def __new__(cls): return Missing - + def __getnewargs__(self): return () diff --git a/tests/test_atoms.py b/tests/test_atoms.py index be7b59f..eaf03aa 100644 --- a/tests/test_atoms.py +++ b/tests/test_atoms.py @@ -31,22 +31,22 @@ class AtomTestCase(unittest.TestCase): def test_atom_singleton(self): - for atom_type, atom, atom_repr in ATOMS: + for atom_type, atom, _ in ATOMS: with self.subTest(atom_type_name=atom_type.__name__): self.assertIs(atom_type(), atom_type()) self.assertIs(atom_type(), atom) def test_atom_pickle_round_trip_is_atom(self): - for atom_type, atom, atom_repr in ATOMS: + for atom_type, atom, _ in ATOMS: with self.subTest(atom_type_name=atom_type.__name__): self.assertIs(pickle.loads(pickle.dumps(atom)), atom) def test_type_of_atom_is_atom_type(self): - for atom_type, atom, atom_repr in ATOMS: + for atom_type, atom, _ in ATOMS: with self.subTest(atom_type_name=atom_type.__name__): self.assertIs(type(atom), atom_type) def test_atom_repr(self): for atom_type, atom, atom_repr in ATOMS: with self.subTest(atom_type_name=atom_type.__name__): - self.assertEqual(repr(atom), atom_repr) \ No newline at end of file + self.assertEqual(repr(atom), atom_repr) diff --git a/tests/test_plan.py b/tests/test_plan.py index bcf725c..d17f87f 100644 --- a/tests/test_plan.py +++ b/tests/test_plan.py @@ -411,4 +411,4 @@ def test_plan_pickle_round_trip(self): result = plan.call(pow, 3, 2) plan2, result2 = pickle.loads(pickle.dumps([plan, result])) self.assertEqual(plan2._scope, ()) - self.assertEqual(uberjob.run(plan2, output=result2), 9) \ No newline at end of file + self.assertEqual(uberjob.run(plan2, output=result2), 9)