File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -42,11 +42,11 @@ def test_minimal_working_example(self):
4242 driver = GraphDatabase .driver ("bolt://localhost" , auth = basic_auth ("neo4j" , "password" ))
4343 session = driver .session ()
4444
45- session .run ("CREATE (neo :Person {name:'Neo ', age:23 })" )
45+ session .run ("CREATE (a :Person {name:'Arthur ', title:'King' })" , )
4646
47- result = session .run ("MATCH (p :Person) WHERE p .name = 'Neo ' RETURN p.age " )
47+ result = session .run ("MATCH (a :Person) WHERE a .name = 'Arthur ' RETURN a.name AS name, a.title AS title " )
4848 while result .next ():
49- print ("Neo is %d years old. " % result ["p.age" ] )
49+ print ("%s %s " % ( result ["title" ], result [ "name" ]) )
5050
5151 session .close ()
5252 # end::minimal-example[]
Original file line number Diff line number Diff line change 3232try :
3333 unicode
3434except NameError :
35+ # Python 3
36+
3537 integer = int
3638 string = str
3739
40+ def ustr (x ):
41+ if isinstance (x , bytes ):
42+ return x .decode ("utf-8" )
43+ elif isinstance (x , str ):
44+ return x
45+ else :
46+ return str (x )
47+
3848 def hex2 (x ):
3949 if x < 0x10 :
4050 return "0" + hex (x )[2 :].upper ()
4151 else :
4252 return hex (x )[2 :].upper ()
4353
4454else :
55+ # Python 2
56+
4557 integer = (int , long )
4658 string = (str , unicode )
4759
60+ def ustr (x ):
61+ if isinstance (x , str ):
62+ return x .decode ("utf-8" )
63+ elif isinstance (x , unicode ):
64+ return x
65+ else :
66+ return unicode (x )
67+
4868 def hex2 (x ):
4969 x = ord (x )
5070 if x < 0x10 :
You can’t perform that action at this time.
0 commit comments