Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #172

Merged
merged 4 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Install enchant
run: |
sudo apt-get -qq update
sudo apt-get -y install enchant
sudo apt-get -y install enchant-2

- name: Install dependencies
run: |
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
repos:
- repo: https://github.com/psf/black
rev: 22.8.0
rev: 23.11.0
hooks:
- id: black
args: ["--target-version", "py37"]

- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: check-merge-conflict
- id: check-yaml
Expand Down
3 changes: 0 additions & 3 deletions jsonmodels/errors.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
class ValidationError(RuntimeError):

pass


class FieldNotFound(RuntimeError):

pass


class FieldNotSupported(ValueError):

pass
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class PyTest(TestCommand):

user_options = [("pytest-args=", "a", "Arguments to pass to py.test")]

def initialize_options(self):
Expand Down
5 changes: 0 additions & 5 deletions tests/test_circular_references.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@


class Primary(models.Base):

name = fields.StringField()
secondary = fields.EmbeddedField("Secondary")


class Secondary(models.Base):

data = fields.IntField()
first = fields.EmbeddedField("Primary")

Expand All @@ -24,19 +22,16 @@ def test_generate_circular_schema():


class File(models.Base):

name = fields.StringField()
size = fields.FloatField()


class Directory(models.Base):

name = fields.StringField()
children = fields.ListField(["Directory", File])


class Filesystem(models.Base):

name = fields.StringField()
children = fields.ListField([Directory, File])

Expand Down
19 changes: 0 additions & 19 deletions tests/test_data_initialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

def test_initialization():
class Person(models.Base):

name = fields.StringField()
surname = fields.StringField()
age = fields.IntField()
Expand Down Expand Up @@ -38,12 +37,10 @@ class Person(models.Base):

def test_deep_initialization():
class Car(models.Base):

brand = fields.StringField()
extra = fields.DictField()

class ParkingPlace(models.Base):

location = fields.StringField()
car = fields.EmbeddedField(Car)

Expand Down Expand Up @@ -89,15 +86,12 @@ class ParkingPlace(models.Base):

def test_deep_initialization_error_with_multitypes():
class Viper(models.Base):

brand = fields.StringField()

class Lamborghini(models.Base):

brand = fields.StringField()

class ParkingPlace(models.Base):

location = fields.StringField()
car = fields.EmbeddedField([Viper, Lamborghini])

Expand All @@ -113,11 +107,9 @@ class ParkingPlace(models.Base):

def test_deep_initialization_with_list():
class Car(models.Base):

brand = fields.StringField()

class Parking(models.Base):

location = fields.StringField()
cars = fields.ListField(items_types=Car)

Expand Down Expand Up @@ -156,15 +148,12 @@ class Parking(models.Base):

def test_deep_initialization_error_with_list_and_multitypes():
class Viper(models.Base):

brand = fields.StringField()

class Lamborghini(models.Base):

brand = fields.StringField()

class Parking(models.Base):

location = fields.StringField()
cars = fields.ListField([Viper, Lamborghini])

Expand Down Expand Up @@ -193,15 +182,12 @@ class Parking(models.Base):

def test_deep_initialization_error_when_result_non_iterable():
class Viper(models.Base):

brand = fields.StringField()

class Lamborghini(models.Base):

brand = fields.StringField()

class Parking(models.Base):

location = fields.StringField()
cars = fields.ListField([Viper, Lamborghini])

Expand All @@ -220,7 +206,6 @@ class Parking(models.Base):

def test_initialization_with_non_models_types():
class Person(models.Base):

names = fields.ListField(str)
surname = fields.StringField()

Expand All @@ -239,7 +224,6 @@ class Person(models.Base):

def test_initialization_with_multi_non_models_types():
class Person(models.Base):

name = fields.StringField()
mix = fields.ListField((str, float))

Expand All @@ -259,7 +243,6 @@ class Person(models.Base):

def test_initialization_with_wrong_types():
class Person(models.Base):

name = fields.StringField()
mix = fields.ListField((str, float))

Expand All @@ -270,11 +253,9 @@ class Person(models.Base):

def test_deep_initialization_for_embed_field():
class Car(models.Base):

brand = fields.StringField()

class ParkingPlace(models.Base):

location = fields.StringField()
car = fields.EmbeddedField(Car)

Expand Down
20 changes: 0 additions & 20 deletions tests/test_datetime_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def dst(self, dt):

def test_time_field():
class Event(models.Base):

time = fields.TimeField()

event = Event()
Expand All @@ -42,7 +41,6 @@ class Event(models.Base):

def test_time_field_not_required():
class Event(models.Base):

time = fields.TimeField(required=False)

event = Event()
Expand All @@ -52,7 +50,6 @@ class Event(models.Base):


def test_time_field_to_struct():

field = fields.TimeField()

assert field.str_format is None
Expand All @@ -65,7 +62,6 @@ def test_time_field_to_struct():


def test_base_field_to_struct():

field = fields.BaseField()
assert field.to_struct(True) is True
assert field.to_struct(False) is False
Expand All @@ -74,7 +70,6 @@ def test_base_field_to_struct():


def test_time_field_to_struct_with_format():

field = fields.TimeField(str_format="%H:%M")

assert "%H:%M" == field.str_format
Expand All @@ -87,7 +82,6 @@ def test_time_field_to_struct_with_format():


def test_time_field_to_struct_with_tz():

field = fields.TimeField()

tt = datetime.time(tzinfo=_TestCet())
Expand All @@ -104,15 +98,13 @@ def test_time_field_to_struct_with_tz():


def test_time_field_format_has_precedence():

field = fields.TimeField(str_format="%H:%M")

tt = datetime.time(12, 34, 56, tzinfo=_TestCet())
assert "12:34" == field.to_struct(tt)


def test_time_field_parse_value():

field = fields.TimeField()

assert datetime.time() == field.parse_value("00:00:00")
Expand All @@ -126,7 +118,6 @@ def test_time_field_parse_value():

def test_date_field():
class Event(models.Base):

date = fields.DateField()

event = Event()
Expand All @@ -138,7 +129,6 @@ class Event(models.Base):

def test_date_field_not_required():
class Event(models.Base):

date = fields.DateField(required=False)

event = Event()
Expand All @@ -148,7 +138,6 @@ class Event(models.Base):


def test_date_field_to_struct():

field = fields.DateField()

assert field.str_format is None
Expand All @@ -161,7 +150,6 @@ def test_date_field_to_struct():


def test_date_field_to_struct_with_format():

field = fields.DateField(str_format="%Y/%m/%d")

assert "%Y/%m/%d" == field.str_format
Expand All @@ -171,7 +159,6 @@ def test_date_field_to_struct_with_format():


def test_date_field_parse_value():

field = fields.DateField()

assert datetime.date(2012, 12, 21) == field.parse_value("2012-12-21")
Expand All @@ -183,7 +170,6 @@ def test_date_field_parse_value():

def test_datetime_field():
class Event(models.Base):

date = fields.DateTimeField()

event = Event()
Expand All @@ -195,7 +181,6 @@ class Event(models.Base):

def test_datetime_field_not_required():
class Event(models.Base):

date = fields.DateTimeField()

event = Event()
Expand All @@ -204,7 +189,6 @@ class Event(models.Base):


def test_datetime_field_to_struct():

field = fields.DateTimeField()

assert field.str_format is None
Expand All @@ -214,7 +198,6 @@ def test_datetime_field_to_struct():


def test_datetime_field_to_struct_with_format():

field = fields.TimeField(str_format="%H:%M %Y/%m")

assert "%H:%M %Y/%m" == field.str_format
Expand All @@ -224,7 +207,6 @@ def test_datetime_field_to_struct_with_format():


def test_datetime_field_to_struct_with_tz():

field = fields.DateTimeField()

tt = datetime.datetime(2014, 5, 7, 12, 45, 56, tzinfo=_TestCet())
Expand All @@ -235,15 +217,13 @@ def test_datetime_field_to_struct_with_tz():


def test_datetime_field_format_has_precedence():

field = fields.DateTimeField(str_format="%H:%M %Y/%m")

tt = datetime.datetime(2014, 5, 7, 12, 45, 56, tzinfo=_TestCet())
assert "12:45 2014/05" == field.to_struct(tt)


def test_datetime_field_parse_value():

field = fields.DateTimeField()

assert datetime.datetime(2014, 4, 21, 12, 45, 56) == field.parse_value(
Expand Down
4 changes: 0 additions & 4 deletions tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@


def test_bool_field():

field = fields.BoolField()

class Person(models.Base):

is_programmer = field

person = Person()
Expand All @@ -31,15 +29,13 @@ class Person(models.Base):


def test_dict_field():

field = fields.DictField()
default_field = fields.DictField(
default={"extra_default": "Hello", "deep_extra": {"spanish": "Hola"}},
validators=[validators.Length(2)],
)

class Person(models.Base):

extra = field
extra_required = fields.DictField(required=True)
extra_default = default_field
Expand Down
Loading
Loading