Skip to content

Commit 132b512

Browse files
committed
Fix pep8, pep257 and isort issues
1 parent d59288f commit 132b512

File tree

7 files changed

+22
-43
lines changed

7 files changed

+22
-43
lines changed

docs/conf.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import os
2+
import pathlib
23
import sys
34

45
from pkg_resources import get_distribution
56

7+
BASE_DIR = pathlib.Path(__file__).resolve(strict=True).parent.parent
8+
69
# This is needed since django_select2 requires django model modules
710
# and those modules assume that django settings is configured and
811
# have proper DB settings.
@@ -12,13 +15,13 @@
1215
# If extensions (or modules to document with autodoc) are in another directory,
1316
# add these directories to sys.path here. If the directory is relative to the
1417
# documentation root, use os.path.abspath to make it absolute, like shown here.
15-
sys.path.insert(0, os.path.abspath('../tests.testapp'))
16-
sys.path.insert(0, os.path.abspath('..'))
18+
sys.path.insert(0, str(BASE_DIR / 'tests'/ 'testapp'))
19+
sys.path.insert(0, str(BASE_DIR))
1720

1821

1922
project = "Django-Select2"
2023
author = "Johannes Hoppe"
21-
copyright = "2017, Johannes Hoppe"
24+
copyright = "2017-2020, Johannes Hoppe"
2225
release = get_distribution('django_select2').version
2326
version = '.'.join(release.split('.')[:2])
2427

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Install ``django-select2``
1111
1212
Add ``django_select2`` to your ``INSTALLED_APPS`` in your project settings.
1313

14-
Add ``django_select`` to your urlconf if you use any "Auto" fields.
14+
Add ``django_select`` to your URL root configuration:
1515

1616
.. code-block:: python
1717

docs/spelling_wordlist.txt

Lines changed: 0 additions & 18 deletions
This file was deleted.

example/example/forms.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django import forms
2+
23
from django_select2 import forms as s2forms
34

45
from . import models

example/example/migrations/0001_initial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Generated by Django 3.1a1 on 2020-05-23 17:06
22

3+
import django.db.models.deletion
34
from django.conf import settings
45
from django.db import migrations, models
5-
import django.db.models.deletion
66

77

88
class Migration(migrations.Migration):

example/example/urls.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,7 @@
1-
"""example URL Configuration
2-
3-
The `urlpatterns` list routes URLs to views. For more information please see:
4-
https://docs.djangoproject.com/en/dev/topics/http/urls/
5-
Examples:
6-
Function views
7-
1. Add an import: from my_app import views
8-
2. Add a URL to urlpatterns: path('', views.home, name='home')
9-
Class-based views
10-
1. Add an import: from other_app.views import Home
11-
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
12-
Including another URLconf
13-
1. Import the include() function: from django.urls import include, path
14-
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
15-
"""
161
from django.conf import settings
172
from django.conf.urls.static import static
183
from django.contrib import admin
19-
from django.urls import path, include
4+
from django.urls import include, path
205

216
from . import views
227

tests/test_forms.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,12 @@ class TestSelect2MixinSettings:
148148
def test_default_media(self):
149149
sut = Select2Widget()
150150
result = sut.media.render()
151-
assert f'https://cdnjs.cloudflare.com/ajax/libs/select2/{settings.SELECT2_LIB_VERSION}/js/select2.min.js' in result
152-
assert f'https://cdnjs.cloudflare.com/ajax/libs/select2/{settings.SELECT2_LIB_VERSION}/css/select2.min.css' in result
151+
assert (
152+
f'https://cdnjs.cloudflare.com/ajax/libs/select2/{settings.SELECT2_LIB_VERSION}/js/select2.min.js'
153+
) in result
154+
assert (
155+
f'https://cdnjs.cloudflare.com/ajax/libs/select2/{settings.SELECT2_LIB_VERSION}/css/select2.min.css'
156+
) in result
153157
assert 'django_select2/django_select2.js' in result
154158

155159
def test_js_setting(self, settings):
@@ -479,7 +483,9 @@ def test_widgets_selected_after_validation_error(self, db, live_server, driver,
479483
WebDriverWait(driver, 60).until(
480484
expected_conditions.presence_of_element_located((By.CSS_SELECTOR, '.select2-selection--single'))
481485
)
482-
country_container, city_container, city2_container = driver.find_elements_by_css_selector('.select2-selection--single')
486+
country_container, city_container, city2_container = driver.find_elements_by_css_selector(
487+
'.select2-selection--single'
488+
)
483489

484490
# clicking city select2 lists all available cities
485491
city_container.click()
@@ -532,7 +538,9 @@ def test_widgets_selected_after_validation_error(self, db, live_server, driver,
532538

533539
def test_dependent_fields_clear_after_change_parent(self, db, live_server, driver, countries, cities):
534540
driver.get(live_server + self.url)
535-
country_container, city_container, city2_container = driver.find_elements_by_css_selector('.select2-selection--single')
541+
country_container, city_container, city2_container = driver.find_elements_by_css_selector(
542+
'.select2-selection--single'
543+
)
536544

537545
# selecting a country really does it
538546
country_container.click()

0 commit comments

Comments
 (0)