[Checkins] SVN: Products.BTreeFolder2/trunk/ Add some tests for correct `getattr` behavior.

Hanno Schlichting hannosch at hannosch.eu
Sun Jul 17 14:18:00 EDT 2011


Log message for revision 122268:
  Add some tests for correct `getattr` behavior.
  

Changed:
  U   Products.BTreeFolder2/trunk/CHANGES.txt
  U   Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/tests/testBTreeFolder2.py

-=-
Modified: Products.BTreeFolder2/trunk/CHANGES.txt
===================================================================
--- Products.BTreeFolder2/trunk/CHANGES.txt	2011-07-15 12:31:20 UTC (rev 122267)
+++ Products.BTreeFolder2/trunk/CHANGES.txt	2011-07-17 18:18:00 UTC (rev 122268)
@@ -4,7 +4,7 @@
 2.13.4 (unreleased)
 -------------------
 
-- Nothing changed yet.
+- Add some tests for correct `getattr` behavior.
 
 
 2.13.3 (2011-03-15)

Modified: Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/tests/testBTreeFolder2.py
===================================================================
--- Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/tests/testBTreeFolder2.py	2011-07-15 12:31:20 UTC (rev 122267)
+++ Products.BTreeFolder2/trunk/src/Products/BTreeFolder2/tests/testBTreeFolder2.py	2011-07-17 18:18:00 UTC (rev 122268)
@@ -43,6 +43,15 @@
         self.f['ff2'] = BTreeFolder2('item2')
         self.assertEqual(self.f.ff2.id, 'item2')
 
+    def test_getattr_found(self):
+        self.assertEqual(getattr(self.f, 'item'), self.ff)
+
+    def test_getattr_notfound(self):
+        self.assertRaises(AttributeError, getattr, self.f, 'none')
+
+    def test_getattr_default(self):
+        self.assertEqual(getattr(self.f, 'none', '1'), '1')
+
     def testCount(self):
         self.assertEqual(self.f.objectCount(), 1)
         self.assertEqual(self.ff.objectCount(), 0)



More information about the checkins mailing list