summaryrefslogtreecommitdiff
path: root/tests/functional/ext/consider_ternary_expression
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/ext/consider_ternary_expression')
-rw-r--r--tests/functional/ext/consider_ternary_expression/consider_ternary_expression.py17
-rw-r--r--tests/functional/ext/consider_ternary_expression/consider_ternary_expression.rc10
-rw-r--r--tests/functional/ext/consider_ternary_expression/consider_ternary_expression.txt2
3 files changed, 29 insertions, 0 deletions
diff --git a/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.py b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.py
new file mode 100644
index 000000000..5ed5eaac4
--- /dev/null
+++ b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.py
@@ -0,0 +1,17 @@
+if f(): # [consider-ternary-expression]
+ x = 4
+else:
+ x = 5
+
+if g():
+ y = 3
+elif h():
+ y = 4
+else:
+ y = 5
+
+def a():
+ if i(): # [consider-ternary-expression]
+ z = 4
+ else:
+ z = 5
diff --git a/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.rc b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.rc
new file mode 100644
index 000000000..39b1d7975
--- /dev/null
+++ b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.rc
@@ -0,0 +1,10 @@
+[MASTER]
+load-plugins=pylint.extensions.consider_ternary_expression,
+
+[MESSAGES CONTROL]
+disable=
+ invalid-name,
+ undefined-variable,
+ unused-variable,
+ missing-function-docstring,
+ missing-module-docstring,
diff --git a/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.txt b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.txt
new file mode 100644
index 000000000..08e51e61d
--- /dev/null
+++ b/tests/functional/ext/consider_ternary_expression/consider_ternary_expression.txt
@@ -0,0 +1,2 @@
+consider-ternary-expression:1:0::Consider rewriting as a ternary expression
+consider-ternary-expression:14:4:a:Consider rewriting as a ternary expression