From 8967c527ff0760bcaafcfc4db874a0b1e9f86316 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Fri, 2 Feb 2024 15:08:22 +0100 Subject: [PATCH] [ruff] Activate use next(iter(x)) instead of list(x)[0] and fix issue --- pyproject.toml | 1 - testing/python/collect.py | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d02beb0bc..723da45dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -160,7 +160,6 @@ ignore = [ # ruff ignore "RUF005", # Consider `(x, *y)` instead of concatenation "RUF012", # Mutable class attributes should be annotated with `typing.ClassVar` - "RUF015", # Prefer `next(iter(x))` over single element slice ] [tool.ruff.format] diff --git a/testing/python/collect.py b/testing/python/collect.py index 4d1f97b34..745550f07 100644 --- a/testing/python/collect.py +++ b/testing/python/collect.py @@ -1209,7 +1209,7 @@ class TestReportInfo: classcol = pytester.collect_by_name(modcol, "TestClass") assert isinstance(classcol, Class) path, lineno, msg = classcol.reportinfo() - func = list(classcol.collect())[0] + func = next(iter(classcol.collect())) assert isinstance(func, Function) path, lineno, msg = func.reportinfo()