From 1f9867eab26c7c817b2c09bb1fe4c94b3178922d Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Fri, 19 Mar 2021 08:01:49 -0500 Subject: [PATCH 1/4] create a data_context.pickle and add a simple test for the data context stored in that pickle file --- .../contexts/tests/data/data_context.pickle | Bin 0 -> 229 bytes .../contexts/tests/data_context_test_case.py | 28 ++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 codetools/contexts/tests/data/data_context.pickle diff --git a/codetools/contexts/tests/data/data_context.pickle b/codetools/contexts/tests/data/data_context.pickle new file mode 100644 index 0000000000000000000000000000000000000000..d98517c4705c67d1ebb29649b0804f5057fc1434 GIT binary patch literal 229 zcmXv|y$*sf5C+7*3X4y{)L@LpT^GaV)a_E>Of=f&=z%W0yA9xU-+!*+MnBleYPbTx z;K!Cv06{@kRklX9_T_zR7{5MPYt}F^aq;9lI)Xx`=ti@i;!MRs5E%VNnybV^M#ujW zEtK$*Ys+bcmOZU96?#$Ax(EkUk|?5fDA#z$2CzfJjyBgk7i#OX0ORY>VdEaw08pY* TZye=b=Ca0acRU>^ZA Date: Fri, 19 Mar 2021 08:08:56 -0500 Subject: [PATCH 2/4] update docstring --- codetools/contexts/tests/data_context_test_case.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/codetools/contexts/tests/data_context_test_case.py b/codetools/contexts/tests/data_context_test_case.py index d1a5f1d..b72a091 100644 --- a/codetools/contexts/tests/data_context_test_case.py +++ b/codetools/contexts/tests/data_context_test_case.py @@ -15,7 +15,9 @@ def create_data_context_pickle(): """ Used to create a pickled DataContext stored in codetools/contexts/tests/data/data_context.pickle. - + + Function is kept for reference. Do not rerun unless you need to override + the existing pickled DataContext to be tested. """ d = DataContext(name='test_context') d['a'] = 1 From 226b007a3e5b6abce2df516695fc3a4b22728ad7 Mon Sep 17 00:00:00 2001 From: Aaron Ayres Date: Fri, 19 Mar 2021 08:23:19 -0500 Subject: [PATCH 3/4] package data --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 4714e1e..d2cecb6 100644 --- a/setup.py +++ b/setup.py @@ -144,6 +144,7 @@ def write_version_py(filename='codetools/_version.py'): package_data={ 'codetools': [ 'contexts/images/*.png', + 'contexts/tests/data/*', 'contexts/tests/with_mask_codes*.py', ], }, From 6764f9eec95739c9de95c461336d33a3e68bce87 Mon Sep 17 00:00:00 2001 From: aaronayres35 <36972686+aaronayres35@users.noreply.github.com> Date: Fri, 19 Mar 2021 06:24:18 -0700 Subject: [PATCH 4/4] Apply suggestions from code review Co-authored-by: Poruri Sai Rahul --- codetools/contexts/tests/data_context_test_case.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/codetools/contexts/tests/data_context_test_case.py b/codetools/contexts/tests/data_context_test_case.py index b72a091..8982d1d 100644 --- a/codetools/contexts/tests/data_context_test_case.py +++ b/codetools/contexts/tests/data_context_test_case.py @@ -12,7 +12,7 @@ from codetools.contexts.tests.abstract_context_test_case import AbstractContextTestCase -def create_data_context_pickle(): +def _create_data_context_pickle(): """ Used to create a pickled DataContext stored in codetools/contexts/tests/data/data_context.pickle. @@ -61,7 +61,7 @@ def test_persistence(): assert d2['b'] == d['b'] -def test_long_term_persistence(): +def test_persistence_backwards_compatibility(): filename = os.fspath( files('codetools.contexts.tests') / 'data' / 'data_context.pickle' ) @@ -148,4 +148,3 @@ class _TestContext(DataContext): assert a == b assert a != c -