diff --git a/setup.cfg b/setup.cfg index c2f4c50..d385663 100644 --- a/setup.cfg +++ b/setup.cfg @@ -3,10 +3,11 @@ universal=1 [isort] known_django = django -sections = FUTURE,STDLIB,THIRDPARTY,DJANGO,FIRSTPARTY,LOCALFOLDER +sections = FUTURE,STDLIB,THIRDPARTY,DJANGO,FIRSTPARTY,TESTS,LOCALFOLDER default_section = THIRDPARTY known_standard_library = requests known_first_party = django_hstore +known_tests = django_hstore_tests multi_line_output = 3 line_length = 100 indent = 4 diff --git a/tests/django_hstore_tests/tests/test_dictionary_field.py b/tests/django_hstore_tests/tests/test_dictionary_field.py index 8aca11e..b2a5dd2 100644 --- a/tests/django_hstore_tests/tests/test_dictionary_field.py +++ b/tests/django_hstore_tests/tests/test_dictionary_field.py @@ -1,33 +1,35 @@ # -*- coding: utf-8 -*- -import sys +import datetime import json import pickle +import sys from decimal import Decimal -import datetime from django import VERSION as DJANGO_VERSION from django import forms +from django.contrib.auth.models import User +from django.core.exceptions import ValidationError +from django.core.urlresolvers import reverse from django.db import transaction from django.db.models.aggregates import Count from django.db.utils import IntegrityError -from django.core.exceptions import ValidationError -from django.core.urlresolvers import reverse -from django.contrib.auth.models import User -from django.utils.encoding import force_text from django.test import TestCase +from django.utils.encoding import force_text from django_hstore import get_version -from django_hstore.forms import DictionaryFieldWidget -from django_hstore.fields import HStoreDict from django_hstore.exceptions import HStoreDictException +from django_hstore.fields import HStoreDict +from django_hstore.forms import DictionaryFieldWidget from django_hstore.utils import get_cast_for_param -from django_hstore_tests.models import (DataBag, - DefaultsModel, - NullableDataBag, - BadDefaultsModel, - UniqueTogetherDataBag, - NumberedDataBag) +from django_hstore_tests.models import ( + BadDefaultsModel, + DataBag, + DefaultsModel, + NullableDataBag, + NumberedDataBag, + UniqueTogetherDataBag +) class TestDictionaryField(TestCase): @@ -64,7 +66,7 @@ def test_decimal(self): def test_long(self): if sys.version < '3': - l = long(100000000000) + l = long(100000000000) # noqa databag = DataBag(name='long') databag.data['long'] = l self.assertEqual(databag.data['long'], force_text(l)) @@ -172,7 +174,6 @@ def test_named_querying(self): def test_aggregates(self): self._create_bitfield_bags() - self.assertEqual(DataBag.objects.filter(data__contains={'b0': '1'}).aggregate(Count('id'))['id__count'], 5) self.assertEqual(DataBag.objects.filter(data__contains={'b1': '1'}).aggregate(Count('id'))['id__count'], 4) diff --git a/tests/django_hstore_tests/tests/test_not_transactional.py b/tests/django_hstore_tests/tests/test_not_transactional.py index e76fd1e..9c25f5f 100644 --- a/tests/django_hstore_tests/tests/test_not_transactional.py +++ b/tests/django_hstore_tests/tests/test_not_transactional.py @@ -1,5 +1,5 @@ from django import VERSION as DJANGO_VERSION -from django.db import transaction, connection +from django.db import connection, transaction from django.test import SimpleTestCase from django_hstore.fields import HStoreDict diff --git a/tests/django_hstore_tests/tests/test_reference_field.py b/tests/django_hstore_tests/tests/test_reference_field.py index f89123c..f245f90 100644 --- a/tests/django_hstore_tests/tests/test_reference_field.py +++ b/tests/django_hstore_tests/tests/test_reference_field.py @@ -1,12 +1,12 @@ -from django.core.urlresolvers import reverse +from django import forms from django.contrib.auth.models import User +from django.core.urlresolvers import reverse from django.test import TestCase -from django import forms from django_hstore.forms import ReferencesFieldWidget -from django_hstore.utils import unserialize_references, serialize_references, acquire_reference +from django_hstore.utils import acquire_reference, serialize_references, unserialize_references -from django_hstore_tests.models import Ref, RefsBag, NullableRefsBag +from django_hstore_tests.models import NullableRefsBag, Ref, RefsBag class TestReferencesField(TestCase): diff --git a/tests/django_hstore_tests/tests/test_schema_mode.py b/tests/django_hstore_tests/tests/test_schema_mode.py index ccbad43..c1f172d 100644 --- a/tests/django_hstore_tests/tests/test_schema_mode.py +++ b/tests/django_hstore_tests/tests/test_schema_mode.py @@ -3,8 +3,6 @@ import shutil import sys -from django_hstore_tests.models import NullSchemaDataBag, SchemaDataBag - import django from django.contrib.auth.models import User from django.core.exceptions import ValidationError @@ -16,6 +14,8 @@ from django_hstore import hstore from django_hstore.virtual import create_hstore_virtual_field +from django_hstore_tests.models import NullSchemaDataBag, SchemaDataBag + if sys.version_info[0] >= 3: from io import StringIO else: diff --git a/tests/django_hstore_tests/tests/test_serialized_dictionary_field.py b/tests/django_hstore_tests/tests/test_serialized_dictionary_field.py index f989651..3655e64 100644 --- a/tests/django_hstore_tests/tests/test_serialized_dictionary_field.py +++ b/tests/django_hstore_tests/tests/test_serialized_dictionary_field.py @@ -2,10 +2,10 @@ import datetime from django import forms -from django.db.models.aggregates import Count +from django.contrib.auth.models import User from django.core.exceptions import ValidationError from django.core.urlresolvers import reverse -from django.contrib.auth.models import User +from django.db.models.aggregates import Count from django.test import TestCase from django_hstore.forms import SerializedDictionaryFieldWidget