def setUp(self): self.registry = ReportRegistry({})
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'))