diff --git a/src/rpft/parsers/creation/flowparser.py b/src/rpft/parsers/creation/flowparser.py index 970e64a..9265c16 100644 --- a/src/rpft/parsers/creation/flowparser.py +++ b/src/rpft/parsers/creation/flowparser.py @@ -514,7 +514,7 @@ def _get_row_action(self, row): ) elif row.type == "remove_from_group": if not row.mainarg_groups: - LOGGER.warning(f"Removing contact from ALL groups.") + LOGGER.warning("Removing contact from ALL groups.") return RemoveContactGroupAction(groups=[], all_groups=True) elif row.mainarg_groups[0] == "ALL": return RemoveContactGroupAction(groups=[], all_groups=True) @@ -559,7 +559,8 @@ def _get_or_create_group(self, name, uuid=None): def _get_row_node(self, row): if ( row.type in ["add_to_group", "remove_from_group", "split_by_group"] - and row.obj_id and row.mainarg_groups + and row.obj_id + and row.mainarg_groups ): self.rapidpro_container.record_group_uuid(row.mainarg_groups[0], row.obj_id) @@ -804,8 +805,9 @@ def _compile_flow(self): to fill in these missing UUIDs in a consistent way. """ - # Caveat/TODO: Need to ensure starting node comes first. - flow_container = FlowContainer(flow_name=self.flow_name, uuid=self.flow_uuid, type=self.flow_type) + flow_container = FlowContainer( + flow_name=self.flow_name, uuid=self.flow_uuid, type=self.flow_type + ) if not len(self.node_group_stack) == 1: raise Exception("Unexpected end of flow. Did you forget end_for/end_block?") self.current_node_group().add_nodes_to_flow(flow_container) diff --git a/src/rpft/rapidpro/models/exceptions.py b/src/rpft/rapidpro/models/exceptions.py index abbacff..c859c34 100644 --- a/src/rpft/rapidpro/models/exceptions.py +++ b/src/rpft/rapidpro/models/exceptions.py @@ -1,8 +1,10 @@ class RapidProActionError(Exception): "Raised if some parameter of a RapidProAction is invalid." + pass class RapidProRouterError(Exception): "Raised if some parameter of a RapidProRouter is invalid." + pass diff --git a/tests/test_contentindexparser.py b/tests/test_contentindexparser.py index 908d7a5..e2bb72e 100644 --- a/tests/test_contentindexparser.py +++ b/tests/test_contentindexparser.py @@ -137,9 +137,9 @@ def test_basic_user_model(self): def test_flow_type(self): ci_sheet = ( - "type,sheet_name,data_sheet,data_row_id,new_name,data_model,options\n" - "create_flow,my_basic_flow,,,,,\n" - "create_flow,my_basic_flow,,,my_other_flow,,flow_type;messaging_background\n" + "type,sheet_name,new_name,data_model,options\n" + "create_flow,my_basic_flow,,,\n" + "create_flow,my_basic_flow,my_other_flow,,flow_type;messaging_background\n" ) my_basic_flow = csv_join( "row_id,type,from,message_text", diff --git a/tests/test_rowparser.py b/tests/test_rowparser.py index ce0b8e8..1c35596 100644 --- a/tests/test_rowparser.py +++ b/tests/test_rowparser.py @@ -173,7 +173,7 @@ def test_convert_empty(self): self.assertEqual(out, self.emptyModel) def test_convert_single_element(self): - self.oneModel = DictModel(**{"dict_field": {"K" : "V"}}) + self.oneModel = DictModel(**{"dict_field": {"K": "V"}}) inputs = [ {"dict_field": ["K", "V"]}, {"dict_field": [["K", "V"]]}, @@ -184,7 +184,7 @@ def test_convert_single_element(self): self.assertEqual(out, self.oneModel) def test_convert_two_element(self): - self.onetwoModel = DictModel(**{"dict_field": {"K1" : "V1", "K2" : "V2"}}) + self.onetwoModel = DictModel(**{"dict_field": {"K1": "V1", "K2": "V2"}}) inputs = [ {"dict_field": [["K1", "V1"], ["K2", "V2"]]}, {"dict_field.K1": "V1", "dict_field.K2": "V2"},