Skip to content

Commit

Permalink
Fixed cast of as_node and as_relationship (#227)
Browse files Browse the repository at this point in the history
* Fixed cast of as_node and as_relationship

UT added, too

* newline added in requirements/example.in

address aiee's comment
  • Loading branch information
wey-gu authored Oct 15, 2022
1 parent b6f2be9 commit 5254be2
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 5 deletions.
4 changes: 2 additions & 2 deletions example/FormatResp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions nebula3/data/DataObject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions requirements/example.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
prettytable
pandas
12 changes: 11 additions & 1 deletion requirements/example.txt
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions tests/test_data_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)

Expand All @@ -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

Expand Down

0 comments on commit 5254be2

Please sign in to comment.