diff --git a/_examples/hi/test.py b/_examples/hi/test.py index 22745c3..0179214 100644 --- a/_examples/hi/test.py +++ b/_examples/hi/test.py @@ -106,6 +106,21 @@ try: except Exception, err: print "caught:", err, "| err-type:",type(err) pass + +try: + hi.Person("name","2") + print "*ERROR* no exception raised!" +except Exception, err: + print "caught:", err, "| err-type:",type(err) + pass + +try: + hi.Person("name",2,3) + print "*ERROR* no exception raised!" +except Exception, err: + print "caught:", err, "| err-type:",type(err) + pass + p = hi.Person("name") print p p = hi.Person("name", 42) @@ -147,13 +162,26 @@ print c c = hi.Couple(P2=hi.Person("p1", 42), P1=hi.Person("p2", 52)) print c -## FIXME(sbinet): this needs a PyCheck - ie: issue#16 -#try: -# hi.Couple(1) -# print "*ERROR* no exception raised!" -#except Exception, err: -# print "caught:", err, "| err-type:",type(err) -# pass +try: + hi.Couple(1) + print "*ERROR* no exception raised!" +except Exception, err: + print "caught:", err, "| err-type:",type(err) + pass + +try: + hi.Couple(1,2) + print "*ERROR* no exception raised!" +except Exception, err: + print "caught:", err, "| err-type:",type(err) + pass + +try: + hi.Couple(P2=1) + print "*ERROR* no exception raised!" +except Exception, err: + print "caught:", err, "| err-type:",type(err) + pass ### test gc print "--- testing GC..." diff --git a/main_test.go b/main_test.go index 4a00aad..18a5c12 100644 --- a/main_test.go +++ b/main_test.go @@ -153,7 +153,9 @@ caught: can't work for 24 hours! --- p.Salary(2): 20 --- p.Salary(24): caught: can't work for 24 hours! --- Person.__init__ -caught: expected string or Unicode object, int found | err-type: +caught: invalid type for 'Name' attribute | err-type: +caught: invalid type for 'Age' attribute | err-type: +caught: Person.__init__ takes at most 2 argument(s) | err-type: hi.Person{Name="name", Age=0} hi.Person{Name="name", Age=42} hi.Person{Name="name", Age=42} @@ -175,6 +177,9 @@ hi.Couple{P1=hi.Person{Name="p1", Age=42}, P2=hi.Person{Name="", Age=0}} hi.Couple{P1=hi.Person{Name="p1", Age=42}, P2=hi.Person{Name="p2", Age=52}} hi.Couple{P1=hi.Person{Name="p1", Age=42}, P2=hi.Person{Name="p2", Age=52}} hi.Couple{P1=hi.Person{Name="p2", Age=52}, P2=hi.Person{Name="p1", Age=42}} +caught: invalid type for 'P1' attribute | err-type: +caught: invalid type for 'P1' attribute | err-type: +caught: invalid type for 'P2' attribute | err-type: --- testing GC... --- len(objs): 100000 --- len(vs): 100000