-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Handel-Isort for sorting imports - Handel-black for formatting code
- Loading branch information
1 parent
717c88e
commit 4119634
Showing
14 changed files
with
67 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -139,4 +139,4 @@ uwsgi.ini | |
nginx.conf | ||
test_app/ | ||
myenv/ | ||
myenv3_8/ | ||
myenv3_8/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.3.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
- id: end-of-file-fixer | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
- id: check-added-large-files | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
- id: check-case-conflict | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
- id: check-merge-conflict | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
- id: check-docstring-first | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
|
||
|
||
- repo: https://github.com/pre-commit/mirrors-isort | ||
rev: v5.10.1 | ||
hooks: | ||
- id: isort | ||
exclude: (migrations/|tests/|docs/|static/|media/).* | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 23.3.0 | ||
hooks: | ||
- id: black | ||
exclude: (migrations/|tests/|docs/|static/|media/).* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Changelog | ||
|
||
All notable changes to this project will be documented in this file. | ||
All notable changes to this project will be documented in this file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ User = get_user_model() | |
|
||
class TestMyModelAdmin: | ||
"""Class for testing MyModelAdmin functionality.""" | ||
|
||
def test_some_functionality(self) -> None: | ||
# Test logic goes here | ||
pass | ||
|
@@ -53,7 +53,7 @@ class TestMyModelAdmin: | |
## Class and Function Naming Conventions | ||
|
||
- **Class Names:** Use the `Test` prefix followed by the name of the class or module being tested. For example, if you're testing the `MyModelAdmin` class, name your test class `TestMyModelAdmin`. | ||
|
||
- **Function Names:** Start function names with `test_` followed by a description of the functionality being tested. For example, `test_formfield_for_foreignkey_sets_queryset`. | ||
|
||
## Markers | ||
|
@@ -139,7 +139,7 @@ User = get_user_model() | |
|
||
class TestMyModelAdmin: | ||
"""Class for testing MyModelAdmin functionality.""" | ||
|
||
def test_formfield_for_foreignkey_sets_queryset(self) -> None: | ||
""" | ||
Test that the formfield for the ForeignKey correctly sets the queryset. | ||
|
@@ -149,10 +149,10 @@ class TestMyModelAdmin: | |
admin_site = AdminSite() | ||
request = HttpRequest() | ||
request.user = User.objects.create_superuser('admin', '[email protected]', 'password') | ||
|
||
model_admin = MyModelAdmin(model=MyModel, admin_site=admin_site) | ||
db_field = MyModel._meta.get_field('related_model') | ||
|
||
with patch.object(MyModelAdmin, 'get_field_queryset', return_value=MyModel.objects.filter(name="Test")) as mock_get_field_queryset: | ||
formfield = model_admin.formfield_for_foreignkey(db_field, request) | ||
mock_get_field_queryset.assert_called_once_with(None, db_field, request) | ||
|
@@ -176,7 +176,7 @@ pytestmark = [ | |
|
||
class TestMyAppConfig: | ||
"""Test MyApp configuration and settings.""" | ||
|
||
def test_check_my_app_config_correct_settings(self, settings) -> None: | ||
""" | ||
Test the MyApp configuration checker with correct settings. | ||
|
@@ -186,7 +186,7 @@ class TestMyAppConfig: | |
settings.MY_SETTING_ENABLED = True | ||
errors = check_my_app_config({}) | ||
assert len(errors) == 0 | ||
|
||
def test_check_my_app_config_invalid_type(self, settings) -> None: | ||
""" | ||
Test the MyApp configuration checker with invalid type settings. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
include iranian_cities/data/*.csv | ||
include README.md | ||
include README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ classifiers = | |
|
||
[options] | ||
include_package_data = true | ||
python_requires = >=3.8 | ||
python_requires = >=3.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
from setuptools import setup, find_packages | ||
from setuptools import find_packages, setup | ||
|
||
setup( | ||
name='django-iranian-cities', | ||
packages=find_packages(exclude=['tests*']), | ||
package_data={'iranian_cities/data': ['*.txt']}, | ||
name="django-iranian-cities", | ||
packages=find_packages(exclude=["tests*"]), | ||
package_data={"iranian_cities/data": ["*.txt"]}, | ||
include_package_data=True, | ||
version='1.0.2', | ||
description='Iranian cities support for Django', | ||
long_description=open('README.md').read(), | ||
long_description_content_type='text/markdown', | ||
author='Sage Team', | ||
author_email='[email protected]', | ||
url='https://github.com/sageteam-org/django-iranian-cities', | ||
download_url='https://github.com/sageteam-org/django-iranian-cities/archive/refs/tags/1.0.0.tar.gz', | ||
keywords=['django', 'python', 'fields', 'city field'], | ||
version="1.0.2", | ||
description="Iranian cities support for Django", | ||
long_description=open("README.md").read(), | ||
long_description_content_type="text/markdown", | ||
author="Sage Team", | ||
author_email="[email protected]", | ||
url="https://github.com/sageteam-org/django-iranian-cities", | ||
download_url="https://github.com/sageteam-org/django-iranian-cities/archive/refs/tags/1.0.0.tar.gz", | ||
keywords=["django", "python", "fields", "city field"], | ||
install_requires=[ | ||
'Django', | ||
] | ||
"Django", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters