From 0c1c13be330a03438ad336459edaaf0f6c07088b Mon Sep 17 00:00:00 2001 From: Roman Mogilatov Date: Thu, 12 Mar 2015 12:45:15 +0200 Subject: [PATCH] updating Catalog override method name --- objects/catalog.py | 10 +++++----- tests/test_providers.py | 3 +++ 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 tests/test_providers.py diff --git a/objects/catalog.py b/objects/catalog.py index c589dbe9..67b42064 100644 --- a/objects/catalog.py +++ b/objects/catalog.py @@ -25,7 +25,7 @@ class AbstractCatalog(object): return attribute @classmethod - def __all_providers__(cls, provider_type=Provider): + def all_providers(cls, provider_type=Provider): """Return set of all class providers.""" providers = set() for attr_name in set(dir(cls)) - set(dir(AbstractCatalog)): @@ -36,22 +36,22 @@ class AbstractCatalog(object): return providers @classmethod - def __override___(cls, overriding): + def override(cls, overriding): """ Override current catalog providers by overriding catalog providers. :param overriding: AbstractCatalog """ - overridden = overriding.__all_providers__() - cls.__all_providers__() + overridden = overriding.all_providers() - cls.all_providers() for name, provider in overridden: overridden_provider = getattr(cls, name) - overridden_provider.__override__(provider) + overridden_provider.override(provider) def overrides(catalog): """Catalog overriding decorator.""" def decorator(overriding_catalog): """Overriding decorator.""" - catalog.__override___(overriding_catalog) + catalog.override(overriding_catalog) return overriding_catalog return decorator diff --git a/tests/test_providers.py b/tests/test_providers.py new file mode 100644 index 00000000..8062daa4 --- /dev/null +++ b/tests/test_providers.py @@ -0,0 +1,3 @@ +""" + +"""