summaryrefslogtreecommitdiff
path: root/tests/functional
diff options
context:
space:
mode:
authorDani Alcala <112832187+clavedeluna@users.noreply.github.com>2023-02-08 18:03:41 -0300
committerGitHub <noreply@github.com>2023-02-08 22:03:41 +0100
commit29684fe0123335fe1906b079f5cdfc2d0250e021 (patch)
treede04ad8b0a4fcc613c08ddefd5d8c8a8397dfbe0 /tests/functional
parent7fd499a903348955cbe120b058659f1fa6a29f1a (diff)
downloadpylint-git-29684fe0123335fe1906b079f5cdfc2d0250e021.tar.gz
Fix `nested-min-max` output msg for sequences (#8234)
Diffstat (limited to 'tests/functional')
-rw-r--r--tests/functional/n/nested_min_max.py23
-rw-r--r--tests/functional/n/nested_min_max.txt6
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/functional/n/nested_min_max.py b/tests/functional/n/nested_min_max.py
index cef63dc2b..151e035dd 100644
--- a/tests/functional/n/nested_min_max.py
+++ b/tests/functional/n/nested_min_max.py
@@ -19,3 +19,26 @@ orig_min(1, orig_min(2, 3)) # [nested-min-max]
# This is too complicated (for now) as there is no clear better way to write it
max(max(i for i in range(10)), 0)
max(max(max(i for i in range(10)), 0), 1)
+
+# These examples can be improved by splicing
+lst = [1, 2]
+max(3, max(lst)) # [nested-min-max]
+max(3, *lst)
+
+nums = (1, 2,)
+max(3, max(nums)) # [nested-min-max]
+max(3, *nums)
+
+nums = {1, 2}
+max(3, max(nums)) # [nested-min-max]
+max(3, *nums)
+
+nums = {1: 2, 7: 10}
+max(3, max(nums)) # [nested-min-max]
+max(3, *nums)
+
+max(3, max(nums.values())) # [nested-min-max]
+max(3, *nums.values())
+
+lst2 = [3, 7, 10]
+max(3, max(nums), max(lst2)) # [nested-min-max]
diff --git a/tests/functional/n/nested_min_max.txt b/tests/functional/n/nested_min_max.txt
index 9bcb663e3..c03f1b500 100644
--- a/tests/functional/n/nested_min_max.txt
+++ b/tests/functional/n/nested_min_max.txt
@@ -6,3 +6,9 @@ nested-min-max:8:0:8:25::Do not use nested call of 'min'; it's possible to do 'm
nested-min-max:11:0:11:25::Do not use nested call of 'min'; it's possible to do 'min(1, 2, 3, 4)' instead:INFERENCE
nested-min-max:12:0:12:40::Do not use nested call of 'min'; it's possible to do 'min(len([]), len([1]), len([1, 2]))' instead:INFERENCE
nested-min-max:17:0:17:27::Do not use nested call of 'orig_min'; it's possible to do 'orig_min(1, 2, 3)' instead:INFERENCE
+nested-min-max:25:0:25:16::Do not use nested call of 'max'; it's possible to do 'max(3, *lst)' instead:INFERENCE
+nested-min-max:29:0:29:17::Do not use nested call of 'max'; it's possible to do 'max(3, *nums)' instead:INFERENCE
+nested-min-max:33:0:33:17::Do not use nested call of 'max'; it's possible to do 'max(3, *nums)' instead:INFERENCE
+nested-min-max:37:0:37:17::Do not use nested call of 'max'; it's possible to do 'max(3, *nums)' instead:INFERENCE
+nested-min-max:40:0:40:26::Do not use nested call of 'max'; it's possible to do 'max(3, *nums.values())' instead:INFERENCE
+nested-min-max:44:0:44:28::Do not use nested call of 'max'; it's possible to do 'max(3, *nums, *lst2)' instead:INFERENCE