mirror of
https://github.com/infeeeee/dyn2py
synced 2025-12-16 22:16:18 +01:00
More tests
This commit is contained in:
@@ -6,9 +6,6 @@ from tests.support import *
|
||||
|
||||
class TestPythonNode(unittest.TestCase):
|
||||
|
||||
# Test needed:
|
||||
# init exception
|
||||
|
||||
def test_init_from_dyn(self):
|
||||
dyn = dyn2py.DynamoFile(f"{INPUT_DIR}/single_node.dyn")
|
||||
node_dict = next((n for n in dyn.full_dict["Nodes"]
|
||||
@@ -17,8 +14,6 @@ class TestPythonNode(unittest.TestCase):
|
||||
# Found a node:
|
||||
self.assertTrue(node_dict)
|
||||
|
||||
node_views = dyn.full_dict["View"]["NodeViews"]
|
||||
|
||||
node = dyn2py.PythonNode(
|
||||
node_dict_from_dyn=node_dict,
|
||||
dynamo_file=dyn
|
||||
@@ -42,3 +37,22 @@ class TestPythonNode(unittest.TestCase):
|
||||
self.assertEqual(node.id, "1c5d99792882409e97e132b3e9f814b0")
|
||||
self.assertEqual(node.engine, "CPython3")
|
||||
self.assertEqual(node.checksum, "8d9091d24788a6fdfa5e1e109298b50e")
|
||||
|
||||
def test_init_exception(self):
|
||||
|
||||
dyn = dyn2py.DynamoFile(f"{INPUT_DIR}/single_node.dyn")
|
||||
node_dict = next((n for n in dyn.full_dict["Nodes"]
|
||||
if n["NodeType"] == "PythonScriptNode"), {})
|
||||
|
||||
extract_single_node_dyn(modify_py=True)
|
||||
|
||||
py = dyn2py.PythonFile(f"{OUTPUT_DIR}/single_node_mod.py")
|
||||
|
||||
with self.assertRaises(dyn2py.PythonNodeException):
|
||||
node1 = dyn2py.PythonNode(
|
||||
node_dict_from_dyn=node_dict,
|
||||
dynamo_file=dyn,
|
||||
python_file=py
|
||||
)
|
||||
|
||||
node2 = dyn2py.PythonNode()
|
||||
|
||||
Reference in New Issue
Block a user