From 22055c3f63a107ba5591c32e949a1ba980f32cae Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Mon, 16 Mar 2015 17:31:16 +0200 Subject: [PATCH] Add tests for catalog.overrides decorator --- tests/test_catalog.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_catalog.py b/tests/test_catalog.py index cc0baf8b..bc055e4d 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -3,6 +3,7 @@ import unittest2 as unittest from objects.catalog import AbstractCatalog +from objects.catalog import overrides from objects.providers import Object from objects.providers import Value @@ -49,3 +50,16 @@ class CatalogTests(unittest.TestCase): """Test getting of all catalog providers of specific type.""" self.assertTrue(len(self.Catalog.all_providers(Object)) == 2) self.assertTrue(len(self.Catalog.all_providers(Value)) == 0) + + def test_overriding(self): + """Test catalog overriding with another catalog.""" + @overrides(self.Catalog) + class OverridingCatalog(self.Catalog): + + """Overriding catalog.""" + + obj = Value(1) + another_obj = Value(2) + + self.assertEqual(self.Catalog.obj(), 1) + self.assertEqual(self.Catalog.another_obj(), 2)