Add tests for header getattr() behavior sanity
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>
Wed, 6 Jul 2011 08:20:44 +0000 (11:20 +0300)
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>
Wed, 6 Jul 2011 08:20:44 +0000 (11:20 +0300)
tests/rpmpython.at

index 01fd722..fe2faca 100644 (file)
@@ -81,9 +81,19 @@ h['arch'] = 'noarch'
 myprint(h['nevra'])
 del h['epoch']
 myprint(h['nevra'])
+for a in ['name', 'bugurl', '__class__', '__foo__', ]:
+    try:
+        x = getattr(h, a)
+        myprint(x)
+    except AttributeError, exc:
+        myprint(exc)
 ],
 [testpkg-5:1.0-1.noarch
-testpkg-1.0-1.noarch]
+testpkg-1.0-1.noarch
+testpkg
+None
+<type 'rpm.hdr'>
+'rpm.hdr' object has no attribute '__foo__']
 )
 
 RPMPY_TEST([reading a package file],[