From 89d8923a2eb953d11ca3fb8ed4cba20b52422d5f Mon Sep 17 00:00:00 2001 From: Tony Meyer Date: Fri, 22 Sep 2023 17:36:23 +1200 Subject: [PATCH] test: fix type hint warnings in test_private tests (#1010) * 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). --- pyproject.toml | 1 + test/test_private.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f8089debc..d4d6b2d22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", diff --git a/test/test_private.py b/test/test_private.py index e74507800..bf85db6a9 100644 --- a/test/test_private.py +++ b/test/test_private.py @@ -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')