From ae0b77d316b7de955f52486809f71d62bf79881d Mon Sep 17 00:00:00 2001 From: Subhash Bhushan Date: Fri, 8 Mar 2019 06:51:49 -0800 Subject: [PATCH] Fix issues reported by tox --- src/protean/core/entity.py | 2 +- src/protean/core/repository/base.py | 3 ++- src/protean/core/repository/factory.py | 1 - tests/core/test_entity.py | 13 ------------- tests/core/test_entity_associations.py | 5 ++--- tests/core/test_entity_state.py | 1 + tests/core/test_q_object.py | 5 +++-- tests/core/test_queryset.py | 1 - 8 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/protean/core/entity.py b/src/protean/core/entity.py index ef305c66..a1a28aa0 100644 --- a/src/protean/core/entity.py +++ b/src/protean/core/entity.py @@ -260,7 +260,7 @@ def order_by(self, order_by: Union[set, str]): def _retrieve_model(self): """Retrieve model details associated with this Entity""" - # FIXME Move to a better placement + # FIXME Move to a better placement # Fetch Model class and connected-adapter from Repository Factory model_cls = repo_factory.get_model(self._entity_cls_name) diff --git a/src/protean/core/repository/base.py b/src/protean/core/repository/base.py index 15f780d6..c77fec5b 100644 --- a/src/protean/core/repository/base.py +++ b/src/protean/core/repository/base.py @@ -6,7 +6,8 @@ from protean.core.exceptions import ConfigurationError from protean.utils import inflection -from protean.utils.query import RegisterLookupMixin, Q +from protean.utils.query import Q +from protean.utils.query import RegisterLookupMixin from .factory import repo_factory from .pagination import Pagination diff --git a/src/protean/core/repository/factory.py b/src/protean/core/repository/factory.py index 010b64b7..d95a7e54 100644 --- a/src/protean/core/repository/factory.py +++ b/src/protean/core/repository/factory.py @@ -6,7 +6,6 @@ from protean.conf import active_config from protean.core.exceptions import ConfigurationError - logger = logging.getLogger('protean.repository') diff --git a/tests/core/test_entity.py b/tests/core/test_entity.py index 3b44ca24..2c1bf20a 100644 --- a/tests/core/test_entity.py +++ b/tests/core/test_entity.py @@ -2,24 +2,11 @@ from collections import OrderedDict -import mock import pytest from tests.support.dog import Dog -from tests.support.dog import DogRelatedByEmail -from tests.support.dog import HasManyDog1 -from tests.support.dog import HasManyDog2 -from tests.support.dog import HasManyDog3 from tests.support.dog import HasOneDog1 -from tests.support.dog import HasOneDog2 -from tests.support.dog import HasOneDog3 from tests.support.dog import RelatedDog -from tests.support.dog import RelatedDog2 -from tests.support.human import HasManyHuman1 -from tests.support.human import HasManyHuman2 -from tests.support.human import HasManyHuman3 from tests.support.human import HasOneHuman1 -from tests.support.human import HasOneHuman2 -from tests.support.human import HasOneHuman3 from tests.support.human import Human from protean.core import field diff --git a/tests/core/test_entity_associations.py b/tests/core/test_entity_associations.py index e917d69d..7d7b619a 100644 --- a/tests/core/test_entity_associations.py +++ b/tests/core/test_entity_associations.py @@ -1,9 +1,6 @@ """ Test cases for Entity Reference field and association types """ import mock import pytest - -from protean.core.exceptions import ValidationError - from tests.support.dog import Dog from tests.support.dog import DogRelatedByEmail from tests.support.dog import HasManyDog1 @@ -22,6 +19,8 @@ from tests.support.human import HasOneHuman3 from tests.support.human import Human +from protean.core.exceptions import ValidationError + class TestReference: """Class to test References (Foreign Key) Association""" diff --git a/tests/core/test_entity_state.py b/tests/core/test_entity_state.py index baee39b3..4ff85ce7 100644 --- a/tests/core/test_entity_state.py +++ b/tests/core/test_entity_state.py @@ -1,5 +1,6 @@ """ Tests for the entity state class""" from tests.support.dog import Dog + from protean.core.exceptions import ValidationError diff --git a/tests/core/test_q_object.py b/tests/core/test_q_object.py index da7da117..e7849202 100644 --- a/tests/core/test_q_object.py +++ b/tests/core/test_q_object.py @@ -1,8 +1,9 @@ """ Test the Q object used for managing filter criteria """ -from protean.utils.query import Q -from protean.core.entity import QuerySet from tests.support.dog import Dog +from protean.core.entity import QuerySet +from protean.utils.query import Q + class TestCriteriaConstruction: """Test Conjunction operations on QuerySet""" diff --git a/tests/core/test_queryset.py b/tests/core/test_queryset.py index 52aae788..f600fe8d 100644 --- a/tests/core/test_queryset.py +++ b/tests/core/test_queryset.py @@ -251,4 +251,3 @@ def test_first_with_cache(self): Dog.create(id=5, name='Berry', age=8, owner='John') assert query.first.id == 2 assert query.all().first.id == 5 -