summaryrefslogtreecommitdiff
path: root/tests/functional/c/consider_swap_variables.py
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2019-07-21 10:56:00 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2019-09-10 11:20:16 +0200
commit997d9d1ec72fce84903da4784ac56fbe30e6da1e (patch)
tree9a0ddd3ba0975e045e408d9793cce096ecaeaa75 /tests/functional/c/consider_swap_variables.py
parent676ec55ff9d8f10e52b740a57e4e62a3255d6709 (diff)
downloadpylint-git-997d9d1ec72fce84903da4784ac56fbe30e6da1e.tar.gz
[functional tests] Rename example_functional_tests.py => e/example_functional_tests.py
Permit to navigate in the functional tests easier.
Diffstat (limited to 'tests/functional/c/consider_swap_variables.py')
-rw-r--r--tests/functional/c/consider_swap_variables.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/functional/c/consider_swap_variables.py b/tests/functional/c/consider_swap_variables.py
new file mode 100644
index 000000000..e3320773f
--- /dev/null
+++ b/tests/functional/c/consider_swap_variables.py
@@ -0,0 +1,25 @@
+# pylint: disable=missing-docstring,invalid-name,using-constant-test
+
+a, b, c, d = 'a b c d'.split()
+
+temp = a # [consider-swap-variables]
+a = b
+b = temp
+
+temp = a # only simple swaps are reported
+a = b
+if True:
+ b = a
+
+temp = a # this is no swap
+a = b
+b = a
+
+temp = a, b # complex swaps are ignored
+a, b = c, d
+c, d = temp
+
+temp = a # [consider-swap-variables]
+a = b # longer swap circles are only reported once
+b = temp
+temp = a