Skip to content

Commit

Permalink
Update .pre-commit-config.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
Ravio1i committed Oct 24, 2021
1 parent 782b0d3 commit a7aea5d
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 35 deletions.
25 changes: 20 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,28 @@ repos:
- id: mixed-line-ending
- id: check-toml
- id: check-merge-conflict

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
additional_dependencies: [ flake8-typing-imports==1.7.0 ]
- repo: https://github.com/ambv/black
rev: 21.9b0
hooks:
- id: black
language_version: python3.9

- repo: local
hooks:
- id: black
name: black
language: system
entry: black
minimum_pre_commit_version: 2.9.2
require_serial: true
types_or: [python, pyi]

- id: pytest
name: pytest
stages: [commit]
language: system
entry: poetry run pytest -s -v .
types: [python]
pass_filenames: false
always_run: true
File renamed without changes.
7 changes: 7 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pytest == "6.2.4"
pytest - cov == "3.0.0"
flake8 == "4.0.1"
poetry == "^1.1.11"
poetry2setup == "^1.0.0"
pre - commit == "^2.15.0"
python - semantic - release == "^7.19.2"
38 changes: 8 additions & 30 deletions tests/unit/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
("2017-10-25T19:00:00.000+02:00", False),
("2017-10-25T19:00:00.000", False),
("2017-10-25", True),
(
datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))),
False,
),
(datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))), False,),
(None, None),
],
)
Expand All @@ -26,10 +23,7 @@ def test_is_date(test_input, expected):
@pytest.mark.parametrize(
"test_input, expected",
[
(
datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))),
"2017-10-25T13:37:10+02:00",
),
(datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), "2017-10-25T13:37:10+02:00",),
(None, None),
],
)
Expand All @@ -41,10 +35,7 @@ def test_datetime_to_str(test_input, expected):
"test_input, expected",
[
(datetime(2017, 10, 25), "2017-10-25"),
(
datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))),
"2017-10-25",
),
(datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), "2017-10-25",),
(None, None),
],
)
Expand Down Expand Up @@ -74,22 +65,10 @@ def time():
[
(None, None),
("2017-10-25", datetime(2017, 10, 25)),
(
"2017-10-25T00:00",
datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))),
),
(
"2017-10-25T10:10",
datetime(2017, 10, 25, 10, 10, tzinfo=timezone(timedelta(seconds=7200))),
),
(
"2017-10-25T10:10+01:00",
datetime(2017, 10, 25, 11, 10, tzinfo=timezone(timedelta(seconds=7200))),
),
(
"2017-10-25T10:10+03:00",
datetime(2017, 10, 25, 9, 10, tzinfo=timezone(timedelta(seconds=7200))),
),
("2017-10-25T00:00", datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))),),
("2017-10-25T10:10", datetime(2017, 10, 25, 10, 10, tzinfo=timezone(timedelta(seconds=7200))),),
("2017-10-25T10:10+01:00", datetime(2017, 10, 25, 11, 10, tzinfo=timezone(timedelta(seconds=7200))),),
("2017-10-25T10:10+03:00", datetime(2017, 10, 25, 9, 10, tzinfo=timezone(timedelta(seconds=7200))),),
],
)
def test_str_to_datetime(time_fixture, test_input, expected):
Expand All @@ -102,8 +81,7 @@ def test_utc_str_to_datetime():


@pytest.mark.parametrize(
"test_input, expected",
[(datetime(2017, 10, 25), datetime(2017, 10, 25)), (None, None)],
"test_input, expected", [(datetime(2017, 10, 25), datetime(2017, 10, 25)), (None, None)],
)
def test_to_datetime(time_fixture, test_input, expected):
assert time_fixture.to_datetime(test_input) == expected

0 comments on commit a7aea5d

Please sign in to comment.