summaryrefslogtreecommitdiff
path: root/tests/functional/u/undefined/undefined_variable_py38.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/functional/u/undefined/undefined_variable_py38.py')
-rw-r--r--tests/functional/u/undefined/undefined_variable_py38.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/functional/u/undefined/undefined_variable_py38.py b/tests/functional/u/undefined/undefined_variable_py38.py
new file mode 100644
index 000000000..818423c8e
--- /dev/null
+++ b/tests/functional/u/undefined/undefined_variable_py38.py
@@ -0,0 +1,17 @@
+"""Tests for undefined variable with assignment expressions"""
+# pylint: disable=using-constant-test
+
+# Tests for annotation of variables and potentially undefinition
+
+def typing_and_assignment_expression():
+ """The variable gets assigned in an assignment expression"""
+ var: int
+ if (var := 1 ** 2):
+ print(var)
+
+
+def typing_and_self_referncing_assignment_expression():
+ """The variable gets assigned in an assignment expression that references itself"""
+ var: int
+ if (var := var ** 2): # [undefined-variable]
+ print(var)