Skip to content
This repository has been archived by the owner on Nov 7, 2024. It is now read-only.

Commit

Permalink
Cleaned up code as per flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
ggoneiESS committed Jun 12, 2023
1 parent f59eb33 commit 7af08cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion nexus_constructor/field_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def find_field_type(item: "ValueType", ignore_names=INVALID_FIELD_NAMES) -> Call
return update_existing_stream_field
elif isinstance(item, Link):
return update_existing_link_field
elif isinstance(item,FileWriter):
elif isinstance(item, FileWriter):
return update_existing_filewriter_field
else:
try:
Expand Down
4 changes: 2 additions & 2 deletions nexus_constructor/json/load_from_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def _load_from_json_dict(self, json_dict: Dict) -> bool:
self.entry_node = self._read_json_object(json_dict[CommonKeys.CHILDREN][0])
self.model.entry.attributes = self.entry_node.attributes
for child in self.entry_node.children:
if isinstance(child, (Dataset, Link, Group)):
if isinstance(child, (Dataset, Link, FileWriter, Group)):
self.model.entry[child.name] = child
else:
self.model.entry.children.append(child)
Expand Down Expand Up @@ -277,7 +277,7 @@ def _read_json_object(self, json_object: Dict, parent_node: Group = None):
elif CommonKeys.MODULE in json_object and NodeType.CONFIG in json_object:
module_type = json_object[CommonKeys.MODULE]
if (
( module_type == WriterModules.DATASET.value or module_type == WriterModules.FILEWRITER.value )
(module_type == WriterModules.DATASET.value or module_type == WriterModules.FILEWRITER.value)
and json_object[NodeType.CONFIG][CommonKeys.NAME]
== CommonAttrs.DEPENDS_ON
):
Expand Down
1 change: 0 additions & 1 deletion nexus_constructor/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ class FieldType(Enum):
filewriter = "Filewriter"



class FieldValueValidator(QValidator):
"""
Validates the field value line edit to check that the entered string is castable to the selected numpy type.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ def test_GIVEN_valid_string_value_WHEN_validating_field_value_THEN_returns_accep
assert validator.validate(strvalue, 0) == QValidator.Acceptable
validator.is_valid.emit.assert_called_once_with(True)


def test_GIVEN_valid_name_value_WHEN_validating_filewriter_THEN_returns_acceptable_and_emits_signal_with_true():
strvalue = "123a"

Expand All @@ -186,6 +187,7 @@ def test_GIVEN_valid_name_value_WHEN_validating_filewriter_THEN_returns_acceptab
assert validator.validate(strvalue, 0) == QValidator.Acceptable
validator.is_valid.emit.assert_called_once_with(True)


def test_GIVEN_invalid_float_value_WHEN_validating_field_value_THEN_returns_intermediate_and_emits_signal_with_false():
invalid_value = "sdfn"

Expand Down

0 comments on commit 7af08cf

Please sign in to comment.