Skip to content

Commit

Permalink
test: fix type hint warnings in test_private tests (#1010)
Browse files Browse the repository at this point in the history
* Silence type warnings.

We are explicitly testing passing the wrong type here, so want this to be incorrect.

* Remove presumably accidental double-call.

Looking more closely, I don't believe the double call was intended. The test still passes because the inner call raises the ValueError all the way up, but that means the outer call is never actually used, and it's a bit weird to be testing that passing a datetime.datetime doesn't work (and it would raise a TypeError anyway).
  • Loading branch information
tonyandrewmeyer authored Sep 22, 2023
1 parent 8c09aa2 commit 89d8923
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ docstring-convention = "google"

[tool.pyright]
include = ["ops/*.py", "ops/_private/*.py",
"test/test_private.py",
"test/test_infra.py",
"test/test_jujuversion.py",
"test/test_log.py",
Expand Down
6 changes: 2 additions & 4 deletions test/test_private.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,7 @@ def test_parse_rfc3339(self):
timeconv.parse_rfc3339('2021-99-99T04:36:22Z')

with self.assertRaises(ValueError):
timeconv.parse_rfc3339(
timeconv.parse_rfc3339('2021-02-10T04:36:22.118970777x'))
timeconv.parse_rfc3339('2021-02-10T04:36:22.118970777x')

with self.assertRaises(ValueError):
timeconv.parse_rfc3339(
timeconv.parse_rfc3339('2021-02-10T04:36:22.118970777-99:99'))
timeconv.parse_rfc3339('2021-02-10T04:36:22.118970777-99:99')

0 comments on commit 89d8923

Please sign in to comment.