From 6fcc5f239fd194f2121568c163b44ad97213aede Mon Sep 17 00:00:00 2001
From: TJ DeVries <devries.timothyj@gmail.com>
Date: Thu, 18 Aug 2022 17:04:28 -0400
Subject: [PATCH] tests: add walrus test to assert proper scoping

---
 .../snapshots/input/walrus/walrus.py          | 19 +++++
 .../snapshots/output/walrus/walrus.py         | 82 +++++++++++++++++++
 2 files changed, 101 insertions(+)
 create mode 100644 packages/pyright-scip/snapshots/input/walrus/walrus.py
 create mode 100644 packages/pyright-scip/snapshots/output/walrus/walrus.py

diff --git a/packages/pyright-scip/snapshots/input/walrus/walrus.py b/packages/pyright-scip/snapshots/input/walrus/walrus.py
new file mode 100644
index 000000000..654d77eb5
--- /dev/null
+++ b/packages/pyright-scip/snapshots/input/walrus/walrus.py
@@ -0,0 +1,19 @@
+import pathlib
+
+numbers = [2, 8, 0, 1, 1, 9, 7, 7]
+
+description = {
+    "length": (num_length := len(numbers)),
+    "sum": (num_sum := sum(numbers)),
+    "mean": num_sum / num_length,
+}
+
+print(num_length)
+
+def inside_function():
+    inner = [2, 8, 0, 1, 1, 9, 7, 7]
+    inner_desc = {
+        "length": (num_length := len(inner)),
+        "sum": (num_sum := sum(inner)),
+        "mean": num_sum / num_length,
+    }
diff --git a/packages/pyright-scip/snapshots/output/walrus/walrus.py b/packages/pyright-scip/snapshots/output/walrus/walrus.py
new file mode 100644
index 000000000..d85f4354c
--- /dev/null
+++ b/packages/pyright-scip/snapshots/output/walrus/walrus.py
@@ -0,0 +1,82 @@
+# < definition scip-python python snapshot-util 0.1 walrus/__init__:
+#documentation (module) walrus
+
+import pathlib
+#      ^^^^^^^ reference  python-stdlib 3.10 pathlib/__init__:
+
+numbers = [2, 8, 0, 1, 1, 9, 7, 7]
+#^^^^^^ definition  snapshot-util 0.1 walrus/numbers.
+#documentation ```python
+#            > builtins.list
+#            > ```
+
+description = {
+#^^^^^^^^^^ definition  snapshot-util 0.1 walrus/description.
+#documentation ```python
+#            > builtins.dict
+#            > ```
+    "length": (num_length := len(numbers)),
+#              ^^^^^^^^^^ definition  snapshot-util 0.1 walrus/num_length.
+#                            ^^^ reference local 0
+#                            external documentation ```python
+#                                        > (function) len: (__obj: Sized, /) -> int
+#                                        > ```
+#                                ^^^^^^^ reference  snapshot-util 0.1 walrus/numbers.
+    "sum": (num_sum := sum(numbers)),
+#           ^^^^^^^ definition  snapshot-util 0.1 walrus/num_sum.
+#                      ^^^ reference  python-stdlib 3.10 builtins/__init__:sum().
+#                      external documentation ```python
+#                                  > (function)
+#                                  > sum(__iterable: Iterable[_LiteralInteger...
+#                                  > 
+#                                  > sum(__iterable: Iterable[_SupportsSumNoD...
+#                                  > 
+#                                  > sum(__iterable: Iterable[_AddableT1@sum]...
+#                                  > ```
+#                          ^^^^^^^ reference  snapshot-util 0.1 walrus/numbers.
+    "mean": num_sum / num_length,
+#           ^^^^^^^ reference  snapshot-util 0.1 walrus/num_sum.
+#                     ^^^^^^^^^^ reference  snapshot-util 0.1 walrus/num_length.
+}
+
+print(num_length)
+#^^^^ reference  python-stdlib 3.10 builtins/__init__:print().
+#external documentation ```python
+#            > (function)
+#            > print(*values: object, sep: str | None =...
+#            > 
+#            > print(*values: object, sep: str | None =...
+#            > ```
+#     ^^^^^^^^^^ reference  snapshot-util 0.1 walrus/num_length.
+
+def inside_function():
+#   ^^^^^^^^^^^^^^^ definition  snapshot-util 0.1 walrus/inside_function().
+#   documentation ```python
+#               > def inside_function(): # -> None:
+#               > ```
+    inner = [2, 8, 0, 1, 1, 9, 7, 7]
+#   ^^^^^ definition local 1
+#   documentation ```python
+#               > builtins.list
+#               > ```
+    inner_desc = {
+#   ^^^^^^^^^^ definition local 2
+#   documentation ```python
+#               > builtins.dict
+#               > ```
+        "length": (num_length := len(inner)),
+#                  ^^^^^^^^^^ definition local 3
+#                                ^^^ reference local 4
+#                                external documentation ```python
+#                                            > (function) len: (__obj: Sized, /) -> int
+#                                            > ```
+#                                    ^^^^^ reference local 1
+        "sum": (num_sum := sum(inner)),
+#               ^^^^^^^ definition local 5
+#                          ^^^ reference  python-stdlib 3.10 builtins/__init__:sum().
+#                              ^^^^^ reference local 1
+        "mean": num_sum / num_length,
+#               ^^^^^^^ reference local 5
+#                         ^^^^^^^^^^ reference local 3
+    }
+
