From 4de3101ed8fc122cdc9ba4b7ae932c2501b5802e Mon Sep 17 00:00:00 2001 From: wey-gu Date: Fri, 14 Oct 2022 19:26:17 +0800 Subject: [PATCH 1/2] Fixed cast of as_node and as_relationship UT added, too --- example/FormatResp.py | 4 ++-- nebula3/data/DataObject.py | 4 ++-- requirements/example.in | 1 + requirements/example.txt | 12 +++++++++++- tests/test_data_type.py | 14 ++++++++++++++ 5 files changed, 30 insertions(+), 5 deletions(-) diff --git a/example/FormatResp.py b/example/FormatResp.py index 15e4000a..9e084609 100644 --- a/example/FormatResp.py +++ b/example/FormatResp.py @@ -47,8 +47,8 @@ def result_to_df(result: ResultSet) -> pd.DataFrame: Value.TVAL: "as_time", Value.DVAL: "as_date", Value.DTVAL: "as_datetime", - Value.VVAL: "as_vertex", - Value.EVAL: "as_edge", + Value.VVAL: "as_node", + Value.EVAL: "as_relationship", Value.PVAL: "as_path", Value.GGVAL: "as_geography", Value.DUVAL: "as_duration", diff --git a/nebula3/data/DataObject.py b/nebula3/data/DataObject.py index e6eaa9e4..a446132e 100644 --- a/nebula3/data/DataObject.py +++ b/nebula3/data/DataObject.py @@ -34,8 +34,8 @@ Value.TVAL: "as_time", Value.DVAL: "as_date", Value.DTVAL: "as_datetime", - Value.VVAL: "as_vertex", - Value.EVAL: "as_edge", + Value.VVAL: "as_node", + Value.EVAL: "as_relationship", Value.PVAL: "as_path", Value.GGVAL: "as_geography", Value.DUVAL: "as_duration", diff --git a/requirements/example.in b/requirements/example.in index deb2d14c..881bf707 100644 --- a/requirements/example.in +++ b/requirements/example.in @@ -1 +1,2 @@ prettytable +pandas \ No newline at end of file diff --git a/requirements/example.txt b/requirements/example.txt index 8edd5195..34d8c655 100644 --- a/requirements/example.txt +++ b/requirements/example.txt @@ -1,10 +1,20 @@ # -# This file is autogenerated by pip-compile with python 3.8 +# This file is autogenerated by pip-compile with python 3.9 # To update, run: # # pip-compile requirements/example.in # +numpy==1.23.4 + # via pandas +pandas==1.5.0 + # via -r requirements/example.in prettytable==2.4.0 # via -r requirements/example.in +python-dateutil==2.8.2 + # via pandas +pytz==2022.4 + # via pandas +six==1.16.0 + # via python-dateutil wcwidth==0.2.5 # via prettytable diff --git a/tests/test_data_type.py b/tests/test_data_type.py index a7d5e902..0ea4050b 100644 --- a/tests/test_data_type.py +++ b/tests/test_data_type.py @@ -348,6 +348,14 @@ def test_cast(self): tmp_map_val.kvs = {b"a": str_val1, b"b": str_val2} map_val.set_mVal(tmp_map_val) + node_val = ttypes.Value() + node_val.set_vVal(self.get_vertex_value(b'Tom')) + + relationship_val = ttypes.Value(eVal=self.get_edge_value(b'Tom', b'Lily')) + + path_val = ttypes.Value() + path_val.set_pVal(self.get_path_value(b'Tom')) + tmp_list_val = NList() tmp_list_val.values = [ bool_val, @@ -357,6 +365,9 @@ def test_cast(self): str_val2, set_val, map_val, + node_val, + relationship_val, + path_val, ] value.set_lVal(tmp_list_val) @@ -373,6 +384,9 @@ def test_cast(self): "car", {"word", "car"}, {"a": "word", "b": "car"}, + ValueWrapper(node_val).as_node(), + ValueWrapper(relationship_val).as_relationship(), + ValueWrapper(path_val).as_path(), ] assert list_val == expect_result From 7e741ea42ca5c026237a65c8bd06c2dbc97ed6b8 Mon Sep 17 00:00:00 2001 From: wey-gu Date: Sat, 15 Oct 2022 11:02:03 +0800 Subject: [PATCH 2/2] newline added in requirements/example.in address aiee's comment --- requirements/example.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/example.in b/requirements/example.in index 881bf707..e3888460 100644 --- a/requirements/example.in +++ b/requirements/example.in @@ -1,2 +1,2 @@ prettytable -pandas \ No newline at end of file +pandas