Skip to content

Commit

Permalink
fixing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Durman committed Jun 4, 2021
1 parent e95e839 commit cbcff9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Binary file modified json_examples/Advanced/Pineapple.zip
Binary file not shown.
7 changes: 3 additions & 4 deletions tests/json_import_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,11 @@ def test_import_examples(self):
new_tree.sv_process = False
importer = JSONImporter.init_from_path(path)
importer.import_into_tree(new_tree, print_log=False)
if importer.has_fails:
raise ImportError(importer.fail_massage)
for node in new_tree.nodes:
if is_old(node):
error_format = "This example contains deprecated node `{}' ({}). Please upgrade the example file."
self.fail(error_format.format(node.name, node.bl_idname))
if is_dummy(node):
error_format = "This example contains dummy node `{}' ({}). Please ensure dependencies before saving file."
self.fail(error_format.format(node.name, node.bl_idname))
self.skipTest("Some dependencies was not installed")
if importer.has_fails:
raise ImportError(importer.fail_massage)
8 changes: 4 additions & 4 deletions utils/sv_json_struct.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ def __init__(self, name: str, logger: FailsLog, structure: dict = None):
"parent": None,
},
"properties": dict(),
"advance_properties": dict(),
"advanced_properties": dict(),
"inputs": dict(),
"outputs": dict(),
"bl_idname": ""
Expand Down Expand Up @@ -619,9 +619,9 @@ def export(self, node, factories: StructFactory, dependencies) -> dict:
_set_optional(self._struct, "outputs", self._struct["outputs"])

if hasattr(node, 'save_to_json'):
node.save_to_json(self._struct["advance_properties"])
node.save_to_json(self._struct["advanced_properties"])

_set_optional(self._struct, "advance_properties", self._struct["advance_properties"])
_set_optional(self._struct, "advanced_properties", self._struct["advanced_properties"])

return self._struct

Expand Down Expand Up @@ -659,7 +659,7 @@ def build(self, node, factories: StructFactory, imported_data: OldNewNames):
if hasattr(node, 'load_from_json'):
with self.logger.add_fail("Setting advance node properties",
f'Tree: {node.id_data.name}, Node: {node.name}'):
node.load_from_json(self._struct.get("advance_properties", dict()), self.version)
node.load_from_json(self._struct.get("advanced_properties", dict()), self.version)

def read_bl_type(self):
return self._struct['bl_idname']
Expand Down

0 comments on commit cbcff9b

Please sign in to comment.