mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-01 00:17:55 +03:00 
			
		
		
		
	Add tests for catalog.overrides decorator
This commit is contained in:
		
							parent
							
								
									d93abe8554
								
							
						
					
					
						commit
						22055c3f63
					
				|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user