Skip to content

Commit

Permalink
simplified tests (#260)
Browse files Browse the repository at this point in the history
* simplified tests and got rid of `deep_copy`

* optimized imports

* passed tests
  • Loading branch information
nh916 authored Aug 8, 2023
1 parent 7a3e5c0 commit aa1889b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 20 deletions.
5 changes: 2 additions & 3 deletions tests/nodes/primary_nodes/test_computational_process.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import copy
import json
import uuid

Expand Down Expand Up @@ -42,8 +41,8 @@ def test_create_complex_computational_process(
computational_process_name = "my computational process name"
computational_process_type = "cross_linking"

ingredient = copy.deepcopy(complex_ingredient_node)
data = copy.deepcopy(simple_data_node)
ingredient = complex_ingredient_node
data = simple_data_node
my_computational_process = cript.ComputationProcess(
name=computational_process_name,
type=computational_process_type,
Expand Down
13 changes: 1 addition & 12 deletions tests/nodes/primary_nodes/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,6 @@ def test_create_complex_data_node(
# assert my_complex_data.citation == [complex_citation_node]


def test_data_type_invalid_vocabulary() -> None:
"""
tests that setting the data type to an invalid vocabulary word gives the expected error
Returns
-------
None
"""
pass


def test_data_getters_and_setters(
simple_data_node,
complex_file_node,
Expand Down Expand Up @@ -104,7 +93,7 @@ def test_data_getters_and_setters(
]

# use setters
comp_process = copy.deepcopy(simple_computational_process_node)
comp_process = simple_computational_process_node
simple_data_node.type = my_data_type
simple_data_node.file = my_new_files
simple_data_node.sample_preparation = simple_process_node
Expand Down
4 changes: 2 additions & 2 deletions tests/nodes/primary_nodes/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ def test_process_getters_and_setters(
simple_process_node.type = new_process_type
simple_process_node.ingredient = [complex_ingredient_node]
simple_process_node.description = new_process_description
equipment = copy.deepcopy(complex_equipment_node)
equipment = complex_equipment_node
simple_process_node.equipment = [equipment]
product = copy.deepcopy(simple_material_node)
product = simple_material_node
simple_process_node.product = [product]
simple_process_node.waste = [simple_material_node]
simple_process_node.prerequisite_process = [simple_process_node]
Expand Down
2 changes: 1 addition & 1 deletion tests/nodes/subobjects/test_computational_forcefiled.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def test_setter_getter(complex_computational_forcefield_node, complex_citation_n
cf2.description = "generic polymer model"
assert cf2.description == "generic polymer model"

data = copy.deepcopy(simple_data_node)
data = simple_data_node
cf2.data += [data]
assert cf2.data[-1] is data

Expand Down
3 changes: 1 addition & 2 deletions tests/nodes/subobjects/test_software_configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import copy
import json
import uuid

Expand All @@ -19,7 +18,7 @@ def test_json(complex_software_configuration_node, complex_software_configuratio

def test_setter_getter(complex_software_configuration_node, simple_algorithm_node, complex_citation_node):
sc2 = complex_software_configuration_node
software2 = copy.deepcopy(sc2.software)
software2 = sc2.software
sc2.software = software2
assert sc2.software is software2

Expand Down

0 comments on commit aa1889b

Please sign in to comment.