示例#1
0
 def setUp(self):
     self.registry = ReportRegistry({})
示例#2
0
class ReportRegistryTest(unittest.TestCase):
    def setUp(self):
        self.registry = ReportRegistry({})

    def testGet(self):
        self.registry.add('register', 'register factory')
        self.registry.add('balance', 'balance factory')
        self.assertEqual('register factory', self.registry['register'])
        self.assertEqual('register factory', self.registry.get('reg'))

    def testAddMultiple(self):
        self.registry.add('register', 'register factory')
        self.assertRaises(Exception, self.registry.add, 'register', 'register factory 2')

    def testAmbiguous(self):
        self.registry.add('register', 'register factory')
        self.registry.add('reimbursements', 'reimbursement factory')

        self.assertIsNone(self.registry.get('re'))