Skip to content

Commit

Permalink
>80 chars cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Leighton committed Jan 31, 2012
1 parent 24638f6 commit 1e8fcf9
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions examples/libtest/AttributeTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,24 @@ def do(self):
class AttributeTest(UnitTest):

def testHasattr(self):
self.assertEqual(hasattr(self, "getName"), True, "AttrTest should have method 'getName'")
self.assertEqual(hasattr(self, "blah"), False, "AttrTest has no method 'getName'")
self.assertEqual(hasattr("", "find"), True, "str should have method 'find', bug #483")
self.assertEqual(hasattr(1.0, "real"), True, "float should have attribute 'real', bug #483")
self.assertEqual(hasattr(1, "real"), True, "int should have attribute 'real', bug #483")
self.assertEqual(hasattr(self, "getName"), True,
"AttrTest should have method 'getName'")
self.assertEqual(hasattr(self, "blah"), False,
"AttrTest has no method 'getName'")
self.assertEqual(hasattr("", "find"), True,
"str should have method 'find', bug #483")
self.assertEqual(hasattr(1.0, "real"), True,
"float should have attribute 'real', bug #483")
self.assertEqual(hasattr(1, "real"), True,
"int should have attribute 'real', bug #483")

def testGetattr(self):
func = getattr(self, "getName")
self.assertEqual(func(), "AttributeTest",
"getattr does not return correct value'")

self.assertEqual(getattr(Foo, 'name'), 'Foo', "attribute mapping, bug #521")
self.assertEqual(getattr(Foo, 'name'),
'Foo', "attribute mapping, bug #521")
self.assertEqual(1, getattr(Foo, "notthere", 1))
foo = Foo(1)
self.assertEqual(foo.v, getattr(foo, "v"))
Expand Down

0 comments on commit 1e8fcf9

Please sign in to comment.