Mercurial > p > roundup > code
comparison test/db_test_base.py @ 1929:b7912efc7f57
Add docstring to safeget method.
Remove handling of invalid propname (YAGNI).
| author | Johannes Gijsbers <jlgijsbers@users.sourceforge.net> |
|---|---|
| date | Sun, 16 Nov 2003 22:56:46 +0000 |
| parents | f5e8aeb1382d |
| children | 767ff2a03eee |
comparison
equal
deleted
inserted
replaced
| 1928:7c1ddebe7589 | 1929:b7912efc7f57 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: db_test_base.py,v 1.9 2003-11-16 19:59:06 jlgijsbers Exp $ | 18 # $Id: db_test_base.py,v 1.10 2003-11-16 22:56:46 jlgijsbers Exp $ |
| 19 | 19 |
| 20 import unittest, os, shutil, errno, imp, sys, time, pprint | 20 import unittest, os, shutil, errno, imp, sys, time, pprint |
| 21 | 21 |
| 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ | 22 from roundup.hyperdb import String, Password, Link, Multilink, Date, \ |
| 23 Interval, DatabaseError, Boolean, Number, Node | 23 Interval, DatabaseError, Boolean, Number, Node |
| 799 ae(self.db.issue.get('2', 'title'), 'issue two') | 799 ae(self.db.issue.get('2', 'title'), 'issue two') |
| 800 | 800 |
| 801 def testSafeGet(self): | 801 def testSafeGet(self): |
| 802 # existent nodeid, existent property | 802 # existent nodeid, existent property |
| 803 self.assertEqual(self.db.user.safeget('1', 'username'), 'admin') | 803 self.assertEqual(self.db.user.safeget('1', 'username'), 'admin') |
| 804 # existent nodeid, nonexistent property | |
| 805 self.assertEqual(self.db.user.safeget('1', 'nonexistent'), None) | |
| 806 # nonexistent nodeid, existent property | 804 # nonexistent nodeid, existent property |
| 807 self.assertEqual(self.db.user.safeget('999', 'username'), None) | 805 self.assertEqual(self.db.user.safeget('999', 'username'), None) |
| 808 # nonexistent nodeid, nonexistent property | |
| 809 self.assertEqual(self.db.user.safeget('999', 'nonexistent'), None) | |
| 810 # different default | 806 # different default |
| 811 self.assertEqual(self.db.issue.safeget('999', 'nosy', []), []) | 807 self.assertEqual(self.db.issue.safeget('999', 'nosy', []), []) |
| 812 | 808 |
| 813 class ROTest(MyTestCase): | 809 class ROTest(MyTestCase): |
| 814 def setUp(self): | 810 def setUp(self): |
