Re: [libgpiod][PATCH 18/22] bindings: python: tests: add missing type annotations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 27, 2024 at 8:57 PM Vincent Fazio <vfazio@xxxxxxxxxxx> wrote:
>
> Signed-off-by: Vincent Fazio <vfazio@xxxxxxxxxxx>
> ---
>  bindings/python/tests/helpers.py             |   6 +-
>  bindings/python/tests/tests_chip.py          |  68 +++++-----
>  bindings/python/tests/tests_chip_info.py     |  14 +-
>  bindings/python/tests/tests_edge_event.py    |  32 ++---
>  bindings/python/tests/tests_info_event.py    |  38 +++---
>  bindings/python/tests/tests_line.py          |   2 +-
>  bindings/python/tests/tests_line_info.py     |  22 ++--
>  bindings/python/tests/tests_line_request.py  | 184 +++++++++++++--------------
>  bindings/python/tests/tests_line_settings.py |  12 +-
>  bindings/python/tests/tests_module.py        |  20 +--
>  10 files changed, 200 insertions(+), 198 deletions(-)
>
> diff --git a/bindings/python/tests/helpers.py b/bindings/python/tests/helpers.py
> index f9a15e8e33f62ad63923bddedc206022eabe96b4..d327da2816594655cec5a76e024e31ff978d5d93 100644
> --- a/bindings/python/tests/helpers.py
> +++ b/bindings/python/tests/helpers.py
> @@ -5,12 +5,12 @@ import os
>
>
>  class LinkGuard:
> -    def __init__(self, src, dst):
> +    def __init__(self, src: str, dst: str) -> None:
>          self.src = src
>          self.dst = dst
>
> -    def __enter__(self):
> +    def __enter__(self) -> None:
>          os.symlink(self.src, self.dst)
>
> -    def __exit__(self, type, val, tb):
> +    def __exit__(self, type, val, tb) -> None:  # type: ignore[no-untyped-def]
>          os.unlink(self.dst)
> diff --git a/bindings/python/tests/tests_chip.py b/bindings/python/tests/tests_chip.py
> index 9110bebf3596557fbacb3c7620e931982f9dc957..9c8f87579469e684ed3b6a5dbcef35e0856127ba 100644
> --- a/bindings/python/tests/tests_chip.py
> +++ b/bindings/python/tests/tests_chip.py
> @@ -12,19 +12,19 @@ from .helpers import LinkGuard
>
>
>  class ChipConstructor(TestCase):
> -    def test_open_existing_chip(self):
> +    def test_open_existing_chip(self) -> None:
>          sim = gpiosim.Chip()
>

I admit I don't know any better but does it really make sense to do it
for individual test cases?

Bart





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux