mirror of https://github.com/go-python/gopy.git
bind: test getter/setter
This commit is contained in:
parent
ba3a48a31b
commit
d6d6d01ece
|
@ -45,3 +45,14 @@ print p.String()
|
|||
print "--- doc(p):"
|
||||
print p.__doc__
|
||||
|
||||
print "--- p.Name = \"foo\"..."
|
||||
p.Name = "foo"
|
||||
|
||||
print "--- p.Age = 42..."
|
||||
p.Age = 42
|
||||
|
||||
print "--- p.String()..."
|
||||
print p.String()
|
||||
print "--- p.Age:", p.Age
|
||||
print "--- p.Name:",p.Name
|
||||
|
||||
|
|
10
main_test.go
10
main_test.go
|
@ -80,8 +80,8 @@ Person is a simple struct
|
|||
|
||||
--- p = hi.Person()...
|
||||
['Age', 'Greet', 'Name', 'String', '__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
|
||||
--- p.Name: None
|
||||
--- p.Age: None
|
||||
--- p.Name:
|
||||
--- p.Age: 0
|
||||
--- doc(hi.Greet):
|
||||
Greet() str
|
||||
|
||||
|
@ -94,6 +94,12 @@ hi.Person{Name="", Age=0}
|
|||
--- doc(p):
|
||||
Person is a simple struct
|
||||
|
||||
--- p.Name = "foo"...
|
||||
--- p.Age = 42...
|
||||
--- p.String()...
|
||||
hi.Person{Name="foo", Age=42}
|
||||
--- p.Age: 42
|
||||
--- p.Name: foo
|
||||
`)
|
||||
buf := new(bytes.Buffer)
|
||||
cmd = exec.Command("python2", "./test.py")
|
||||
|
|
Loading…
Reference in New Issue