diff --git a/_examples/hi/hi.go b/_examples/hi/hi.go index 35f0cd7..f47acd0 100644 --- a/_examples/hi/hi.go +++ b/_examples/hi/hi.go @@ -9,6 +9,16 @@ import ( "fmt" ) +const ( + Version = "0.1" // Version of this package + Universe = 42 // Universe is the fundamental constant of everything +) + +var ( + Debug = false // Debug switches between debug and prod + Anon = Person{Age: 1, Name: ""} // Anon is a default anonymous person +) + // Hi prints hi from Go func Hi() { fmt.Printf("hi from go\n") diff --git a/_examples/hi/test.py b/_examples/hi/test.py index 7b760bc..0c22af8 100644 --- a/_examples/hi/test.py +++ b/_examples/hi/test.py @@ -3,6 +3,24 @@ import hi print "--- doc(hi)..." print hi.__doc__ +print "--- hi.GetUniverse():", hi.GetUniverse() +print "--- hi.GetVersion():", hi.GetVersion() + +print "--- hi.GetDebug():",hi.GetDebug() +print "--- hi.SetDebug(true)" +hi.SetDebug(True) +print "--- hi.GetDebug():",hi.GetDebug() +print "--- hi.SetDebug(false)" +hi.SetDebug(False) +print "--- hi.GetDebug():",hi.GetDebug() + +print "--- hi.GetAnon():",hi.GetAnon() +anon = hi.NewPerson('you',24) +print "--- new anon:",anon +print "--- hi.SetAnon(hi.NewPerson('you', 24))..." +hi.SetAnon(anon) +print "--- hi.GetAnon():",hi.GetAnon() + print "--- doc(hi.Hi)..." print hi.Hi.__doc__ diff --git a/main_test.go b/main_test.go index 38487e6..f827545 100644 --- a/main_test.go +++ b/main_test.go @@ -59,6 +59,17 @@ worked for 4 hours --- doc(hi)... package hi exposes a few Go functions to be wrapped and used from Python. +--- hi.GetUniverse(): 42 +--- hi.GetVersion(): 0.1 +--- hi.GetDebug(): False +--- hi.SetDebug(true) +--- hi.GetDebug(): True +--- hi.SetDebug(false) +--- hi.GetDebug(): False +--- hi.GetAnon(): hi.Person{Name="", Age=1} +--- new anon: hi.Person{Name="you", Age=24} +--- hi.SetAnon(hi.NewPerson('you', 24))... +--- hi.GetAnon(): hi.Person{Name="you", Age=24} --- doc(hi.Hi)... Hi()