Skip to content

Commit

Permalink
Add data io tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Aiee committed Jan 13, 2022
1 parent a8a1c24 commit 9c18d53
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tests/test_data_from_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setUpClass(cls) -> None:
start_school date, morning time, property double,
is_girl bool, child_name fixed_string(10), expend float,
first_out_city timestamp, hobby string);
CREATE TAG IF NOT EXISTS student(name string);
CREATE TAG IF NOT EXISTS student(name string, interval duration);
CREATE EDGE IF NOT EXISTS like(likeness double);
CREATE EDGE IF NOT EXISTS friend(start_year int, end_year int);
CREATE TAG INDEX IF NOT EXISTS person_name_index ON person(name(8));
Expand Down Expand Up @@ -73,9 +73,12 @@ def setUpClass(cls) -> None:
)
assert resp.is_succeeded(), resp.error_msg()
resp = cls.session.execute(
"INSERT VERTEX student(name) VALUES "
"'Bob':('Bob'), 'Lily':('Lily'), "
"'Tom':('Tom'), 'Jerry':('Jerry'), 'John':('John')"
"INSERT VERTEX student(name, interval) VALUES "
"'Bob':('Bob', duration({months:1, seconds:100, microseconds:20})),"
"'Lily':('Lily', duration({years: 1, seconds: 0})),"
"'Tom':('Tom', duration({years: 1, seconds: 0})),"
"'Jerry':('Jerry', duration({years: 1, seconds: 0})),"
"'John':('John', duration({years: 1, seconds: 0}))"
)
assert resp.is_succeeded(), resp.error_msg()

Expand Down Expand Up @@ -233,15 +236,15 @@ def test_path_type(self):
assert resp.row_values(0)[0].is_path()
path = resp.row_values(0)[0].as_path()
expected_str = (
'("Bob" :student{name: "Bob"} '
'("Bob" :student{interval: P1MT100.000020000S, name: "Bob"} '
':person{hobby: __NULL__, expend: 100.0, book_num: 100, '
'property: 1000.0, grade: 3, child_name: "Hello Worl", '
'start_school: 2017-09-10, friends: 10, '
'morning: utc time: 23:10:00.000000, timezone_offset: 28800, first_out_city: 1111, '
'name: "Bob", age: 10, '
'birthday: utc datetime: 2010-09-10T02:08:02.000000, timezone_offset: 28800, is_girl: False})'
'-[:friend@0{end_year: 2020, start_year: 2018}]->'
'("Lily" :student{name: "Lily"} '
'("Lily" :student{interval: P12MT0.000000000S, name: "Lily"} '
':person{is_girl: False, '
'birthday: utc datetime: 2010-09-10T02:08:02.000000, timezone_offset: 28800, age: 9, '
'book_num: 100, grade: 3, property: 1000.0, hobby: __NULL__, expend: 100.0, '
Expand Down Expand Up @@ -292,6 +295,7 @@ def test_complex_types(self):
"person.property": 1000,
"person.start_school": '2017-09-10',
"student.name": "Bob",
"student.interval": "P1MT100.000020000S",
}
]
json_obj = json.loads(resp)
Expand Down

0 comments on commit 9c18d53

Please sign in to comment.