

def test_global_registry(self):
    api = Api()
    self.assertEqual(len(api._registry), 0)
    api.register(NoteResource())
    self.assertEqual(len(api._registry), 1)
    self.assertEqual(sorted(api._registry.keys()), ['notes'])
    api.register(UserResource())
    self.assertEqual(len(api._registry), 2)
    self.assertEqual(sorted(api._registry.keys()), ['notes', 'users'])
    api.register(UserResource())
    self.assertEqual(len(api._registry), 2)
    self.assertEqual(sorted(api._registry.keys()), ['notes', 'users'])
    self.assertEqual(len(api._canonicals), 2)
    api.register(UserResource(), canonical=False)
    api.assertEqual(len(api._registry), 2)
    self.assertEqual(sorted(api._registry.keys()), ['notes', 'users'])
    self.assertEqual(len(api._canonicals), 2)

dataset/ETHPy150Open mozilla/inventory/vendor-local/src/django-tastypie/tests/core/tests/api.py ApiTestCase.test_global_registry/VarMisuse@190/225 `self`->`api`