22
33from test .tck import tck_util
44
5- from neo4j .v1 .typesystem import Node , Relationship , Path
6-
75use_step_matcher ("re" )
86
97
@@ -13,19 +11,19 @@ def step_impl(context):
1311 # check if running
1412
1513
16- @given ("a value (?P<Input >.+) of type (?P<BoltType >.+)" )
17- def step_impl (context , Input , BoltType ):
18- context .expected = tck_util .get_bolt_value (BoltType , Input )
14+ @given ("a value (?P<input >.+) of type (?P<bolt_type >.+)" )
15+ def step_impl (context , input , bolt_type ):
16+ context .expected = tck_util .get_bolt_value (bolt_type , input )
1917
2018
21- @given ("a value of type (?P<BoltType >.+)" )
22- def step_impl (context , BoltType ):
23- context .expected = tck_util .get_bolt_value (BoltType , u' ' )
19+ @given ("a value of type (?P<bolt_type >.+)" )
20+ def step_impl (context , bolt_type ):
21+ context .expected = tck_util .get_bolt_value (bolt_type , u' ' )
2422
2523
26- @given ("a list value (?P<Input >.+) of type (?P<BoltType >.+)" )
27- def step_impl (context , Input , BoltType ):
28- context .expected = tck_util .get_list_from_feature_file (Input , BoltType )
24+ @given ("a list value (?P<input >.+) of type (?P<bolt_type >.+)" )
25+ def step_impl (context , input , bolt_type ):
26+ context .expected = tck_util .get_list_from_feature_file (input , bolt_type )
2927
3028
3129@given ("an empty list L" )
@@ -43,14 +41,14 @@ def step_impl(context, size):
4341 context .expected = tck_util .get_random_string (int (size ))
4442
4543
46- @given ("a List of size (?P<size>\d+) and type (?P<Type >.+)" )
47- def step_impl (context , size , Type ):
48- context .expected = tck_util .get_list_of_random_type (int (size ), Type )
44+ @given ("a List of size (?P<size>\d+) and type (?P<type >.+)" )
45+ def step_impl (context , size , type ):
46+ context .expected = tck_util .get_list_of_random_type (int (size ), type )
4947
5048
51- @given ("a Map of size (?P<size>\d+) and type (?P<Type >.+)" )
52- def step_impl (context , size , Type ):
53- context .expected = tck_util .get_dict_of_random_type (int (size ), Type )
49+ @given ("a Map of size (?P<size>\d+) and type (?P<type >.+)" )
50+ def step_impl (context , size , type ):
51+ context .expected = tck_util .get_dict_of_random_type (int (size ), type )
5452
5553
5654@step ("adding a table of lists to the list L" )
@@ -68,7 +66,7 @@ def step_impl(context):
6866@step ("adding a table of values to the map M" )
6967def step_impl (context ):
7068 for row in context .table :
71- context .M ['a' + str ( len (context .M ) )] = tck_util .get_bolt_value (row [0 ], row [1 ])
69+ context .M ['a%d' % len (context .M )] = tck_util .get_bolt_value (row [0 ], row [1 ])
7270
7371
7472@step ("adding map M to list L" )
@@ -79,40 +77,40 @@ def step_impl(context):
7977@when ("adding a table of lists to the map M" )
8078def step_impl (context ):
8179 for row in context .table :
82- context .M ['a' + str ( len (context .M ) )] = tck_util .get_list_from_feature_file (row [1 ], row [0 ])
80+ context .M ['a%d' % len (context .M )] = tck_util .get_list_from_feature_file (row [1 ], row [0 ])
8381
8482
8583@step ("adding a copy of map M to map M" )
8684def step_impl (context ):
87- context .M ['a' + str ( len (context .M ) )] = context .M .copy ()
85+ context .M ['a%d' % len (context .M )] = context .M .copy ()
8886
8987
9088@when ("the driver asks the server to echo this value back" )
9189def step_impl (context ):
9290 context .results = {}
93- context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypger_text (context .expected ))
91+ context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypher_text (context .expected ))
9492 context .results ["as_parameters" ] = tck_util .send_parameters ("RETURN {input}" , {'input' : context .expected })
9593
9694
9795@when ("the driver asks the server to echo this list back" )
9896def step_impl (context ):
9997 context .expected = context .L
10098 context .results = {}
101- context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypger_text (context .expected ))
99+ context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypher_text (context .expected ))
102100 context .results ["as_parameters" ] = tck_util .send_parameters ("RETURN {input}" , {'input' : context .expected })
103101
104102
105103@when ("the driver asks the server to echo this map back" )
106104def step_impl (context ):
107105 context .expected = context .M
108106 context .results = {}
109- context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypger_text (context .expected ))
107+ context .results ["as_string" ] = tck_util .send_string ("RETURN " + tck_util .as_cypher_text (context .expected ))
110108 context .results ["as_parameters" ] = tck_util .send_parameters ("RETURN {input}" , {'input' : context .expected })
111109
112110
113111@then ("the result returned from the server should be a single record with a single value" )
114112def step_impl (context ):
115- assert len ( context .results ) > 0
113+ assert context .results
116114 for result in context .results .values ():
117115 assert len (result ) == 1
118116 assert len (result [0 ]) == 1
@@ -123,18 +121,4 @@ def step_impl(context):
123121 assert len (context .results ) > 0
124122 for result in context .results .values ():
125123 result_value = result [0 ].values ()[0 ]
126- assert result_value == context .expected
127-
128-
129- @step ("the node value given in the result should be the same as what was sent" )
130- def step_impl (context ):
131- assert len (context .results ) > 0
132- for result in context .results .values ():
133- result_value = result [0 ].values ()[0 ]
134- assert result_value == context .expected
135- assert result_value .labels == context .expected .labels
136- assert result_value .keys () == context .expected .keys ()
137- assert result_value .values () == context .expected .values ()
138- assert result_value .items () == context .expected .items ()
139- assert len (result_value ) == len (context .expected )
140- assert iter (result_value ) == iter (context .expected )
124+ assert result_value == context .expected
0 commit comments