Skip to content
Snippets Groups Projects
Commit 0f06470c authored by James Johnson's avatar James Johnson
Browse files

Renamed things from pop_traits to pop_traits_version

parent e1454c4d
No related branches found
No related tags found
1 merge request!152Removed __traits_version__ from json files
This commit is part of merge request !152. Comments created here will be created in the context of that merge request.
......@@ -14,7 +14,7 @@ from force_bdss.tests.dummy_classes.factory_registry_plugin import \
DummyFactoryRegistryPlugin
from force_bdss.io.workflow_writer import WorkflowWriter, traits_to_dict,\
pop_traits
pop_traits_version
from force_bdss.core.workflow import Workflow
......@@ -91,11 +91,11 @@ class TestWorkflowWriter(unittest.TestCase):
def test_pop_traits_version(self):
test_dictionary = {'Entry1': {'Entry1-1': 4, '__traits_version__':67},
test_dictionary = {'Entry1': {'Entry1-1': 4, '__traits_version__': 67},
'Entry2': [3, 'a', {'Entry2-1': 5,
'__traits_version__': 9001}],
'__traits_version__': 13}
result_dictionary = {'Entry1': {'Entry1-1': 4, },
'Entry2': [3, 'a', {'Entry2-1': 5, }], }
traitless_dictionary = pop_traits(test_dictionary)
self.assertEqual(traitless_dictionary,result_dictionary)
traitless_dictionary = pop_traits_version(test_dictionary)
self.assertEqual(traitless_dictionary, result_dictionary)
......@@ -111,12 +111,12 @@ def pop_traits_version(dictionary):
for key in dictionary:
# If we have a dict, remove the traits version
if isinstance(dictionary[key], dict):
pop_traits(dictionary[key])
pop_traits_version(dictionary[key])
# If we have a non-dict which contains a dict, remove traits from
# that as well
elif isinstance(dictionary[key], Iterable):
for element in dictionary[key]:
if isinstance(element, dict):
pop_traits(element)
pop_traits_version(element)
return dictionary
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment