Skip to content

Commit

Permalink
Merge pull request #144 from druids/SupportPython3.9-3.11
Browse files Browse the repository at this point in the history
Support newer pythons
  • Loading branch information
matllubos committed Jan 3, 2023
2 parents 5612afa + 0a11e01 commit 04bbb86
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Expand Up @@ -17,7 +17,7 @@ indent_size = 4
indent_style = space
indent_size = 4
line_length=120
known_third_party=factory,ipware,responses,requests,nose,south,coverage,six,suds,geopy,user_agents,celery,dateutil,jsonfield,easymode,PIL,pillow,mock,xlrd,attrdict,jinja2,phonenumber_field,magic
known_third_party=factory,ipware,responses,requests,nose,south,coverage,six,suds,geopy,user_agents,celery,dateutil,jsonfield,easymode,PIL,pillow,mock,xlrd,jinja2,phonenumber_field,magic
multi_line_output=0
lines_after_imports=2
known_django=django
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/django.yml
Expand Up @@ -13,16 +13,25 @@ jobs:
max-parallel: 4
matrix:
include:
- python-version: 3.7
- python-version: "3.7"
django-version: Django==3.1

- python-version: 3.8
- python-version: "3.8"
django-version: Django==3.1

- python-version: 3.7
- python-version: "3.7"
django-version: Django==3.2

- python-version: 3.8
- python-version: "3.8"
django-version: Django==3.2

- python-version: "3.9"
django-version: Django==3.2

- python-version: "3.10"
django-version: Django==3.2

- python-version: "3.11"
django-version: Django==3.2

steps:
Expand Down
24 changes: 17 additions & 7 deletions LICENSE
@@ -1,11 +1,21 @@
Copyright 2017 Luboš Mátl, Lukáš Rychtecký, Oskar Hollmann
MIT License

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Copyright (c) 2019 django-GDPR

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -38,4 +38,4 @@ You are welcomed to contribute at https://github.com/druids/django-chamber. Ther

## License

This library is licenced under the 3-clause BSD licence. See the LICENCE file for details.
This library is licenced under MIT licence. See the LICENCE file for details.
4 changes: 2 additions & 2 deletions chamber/utils/datastructures.py
@@ -1,6 +1,6 @@
import re

from collections import MutableSet, OrderedDict
from collections.abc import MutableSet
from itertools import chain


Expand All @@ -16,7 +16,7 @@ def __init__(self, *items):
if not ENUM_KEY_PATTERN.match(k):
raise ValueError('Enum key "{}" has invalid format'.format(k))

self._container = OrderedDict(items)
self._container = dict(items)
self._reverse_container = {item[1]: item[0] for item in items}

def _has_attr(self, name):
Expand Down
4 changes: 2 additions & 2 deletions example/dj/apps/test_chamber/tests/formatters/__init__.py
Expand Up @@ -2,7 +2,7 @@

from chamber.formatters import natural_number_with_currency

from germanium.decorators import data_provider # pylint: disable=E0401
from germanium.decorators import data_consumer # pylint: disable=E0401
from germanium.tools import assert_equal # pylint: disable=E0401


Expand All @@ -15,6 +15,6 @@ class FormattersTestCase(TestCase):
(1000000.00, 'CZK', False, True, '1\xa0000\xa0000\xa0CZK'),
)

@data_provider(numbers_with_currencies)
@data_consumer(numbers_with_currencies)
def test_should_return_natural_number_with_currency(self, number, currency, show_decimal_place, use_nbsp, expected):
assert_equal(expected, natural_number_with_currency(number, currency, show_decimal_place, use_nbsp))
4 changes: 2 additions & 2 deletions example/dj/apps/test_chamber/tests/models/fields.py
Expand Up @@ -11,7 +11,7 @@
from chamber.models.fields import generate_random_upload_path
from chamber.shortcuts import change_and_save

from germanium.decorators import data_provider
from germanium.decorators import data_consumer
from germanium.tools import assert_equal, assert_is_none, assert_false, assert_is_not_none, assert_raises, assert_true

from test_chamber.models import CSVRecord, TestFieldsModel # pylint: disable=E0401
Expand Down Expand Up @@ -146,7 +146,7 @@ def test_should_check_total_price_form_field(self):
('total_price', ugettext_lazy('CZK'), {'max_digits', 'decimal_places', 'validators'}),
)

@data_provider(model_fields)
@data_consumer(model_fields)
def test_should_assert_form_field(self, field_name, currency, kwargs_to_remove):
field = TestFieldsModel._meta.get_field(field_name) # pylint: disable=W0212
assert_equal(currency, field.currency)
Expand Down
Expand Up @@ -2,7 +2,7 @@

from chamber.models.humanized_helpers import price_humanized

from germanium.decorators import data_provider # pylint: disable=E0401
from germanium.decorators import data_consumer # pylint: disable=E0401
from germanium.tools import assert_equal # pylint: disable=E0401


Expand All @@ -15,6 +15,6 @@ class HumanizedHelpersTestCase(TestCase):
(None, None, '(None)'),
)

@data_provider(numbers_with_currencies)
@data_consumer(numbers_with_currencies)
def test_should_return_price_humanized(self, number, currency, expected):
assert_equal(expected, price_humanized(number, None, currency))
4 changes: 2 additions & 2 deletions example/dj/apps/test_chamber/tests/storages/boto3.py
Expand Up @@ -3,7 +3,7 @@

from chamber.storages.boto3 import force_bytes_content

from germanium.decorators import data_provider
from germanium.decorators import data_consumer


class S3StorageTestCase(TestCase):
Expand All @@ -13,7 +13,7 @@ class S3StorageTestCase(TestCase):
(b'Hello, this is bytes content.', b'Hello, this is bytes content.', False),
)

@data_provider(TEST_DATA)
@data_consumer(TEST_DATA)
def test_s3storage_casts_content_to_bytes_if_needed(self, content, content_result, should_cast):
file = ContentFile(content)
result, casted = force_bytes_content(file)
Expand Down
6 changes: 3 additions & 3 deletions example/dj/apps/test_chamber/tests/utils/__init__.py
Expand Up @@ -9,7 +9,7 @@
get_class_method, keep_spacing, remove_accent, call_function_with_unknown_input, InvalidFunctionArguments
)

from germanium.decorators import data_provider # pylint: disable=E0401
from germanium.decorators import data_consumer # pylint: disable=E0401
from germanium.tools import assert_equal, assert_true # pylint: disable=E0401

from .datastructures import * # NOQA
Expand Down Expand Up @@ -60,7 +60,7 @@ def test_should_remove_accent_from_string_when_unicode_error(self):
[None, TestClass(), 'invalid'],
]

@data_provider(classes_and_method_names)
@data_consumer(classes_and_method_names)
def test_get_class_method_should_return_right_class_method_or_none(self, expected_method, cls_or_inst, method_name):
assert_equal(expected_method, get_class_method(cls_or_inst, method_name))

Expand All @@ -72,7 +72,7 @@ def test_get_class_method_should_return_right_class_method_or_none(self, expecte
['Hello <b> escaped</b> <br />world', mark_safe('Hello <b> escaped</b> \r\nworld'), True]
]

@data_provider(values_for_keep_spacing)
@data_consumer(values_for_keep_spacing)
def test_should_keep_spacing(self, expected, value, autoescape):
escaped_value = keep_spacing(value, autoescape)
assert_equal(expected, escaped_value)
Expand Down
2 changes: 1 addition & 1 deletion example/requirements.txt
Expand Up @@ -3,7 +3,7 @@ flake8
freezegun==1.1.0
coveralls
diff-match-patch==20110725.1
django-germanium==2.1.0
django-germanium==2.3.6
six==1.10.0
Pillow==9.3.0
boto3==1.16.47
Expand Down
9 changes: 7 additions & 2 deletions setup.py
Expand Up @@ -4,6 +4,7 @@


setup(
python_requires=">=3.6",
name='django-chamber',
version=get_version(),
description='Utilities library meant as a complement to django-is-core.',
Expand All @@ -19,8 +20,12 @@
'License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Framework :: Django',
],
install_requires=[
Expand Down

0 comments on commit 04bbb86

Please sign in to comment.