summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-06-18 21:30:51 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-06-19 09:13:16 +0200
commitc6ddb53c4c53556bc3c95b86e837c05f449082f3 (patch)
tree3063eb7dfc69cd319d374e449c1a5082959e2485 /tests
parentdd9203ff3eadaaa436ded9036a46c9dec3ec4307 (diff)
downloadastroid-git-c6ddb53c4c53556bc3c95b86e837c05f449082f3.tar.gz
Use the Context enum directly and not a constant based on it
See https://github.com/PyCQA/astroid/pull/1045\#discussion_r654575507
Diffstat (limited to 'tests')
-rw-r--r--tests/unittest_nodes.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/unittest_nodes.py b/tests/unittest_nodes.py
index 6944e59b..011654e1 100644
--- a/tests/unittest_nodes.py
+++ b/tests/unittest_nodes.py
@@ -40,7 +40,7 @@ import astroid
from astroid import bases, builder
from astroid import context as contextmod
from astroid import node_classes, nodes, parse, test_utils, transforms, util
-from astroid.const import PY38, PY310, Del, Load, Store
+from astroid.const import PY38, PY310, Context
from astroid.exceptions import (
AstroidBuildingError,
AstroidSyntaxError,
@@ -928,24 +928,24 @@ class Python35AsyncTest(unittest.TestCase):
class ContextTest(unittest.TestCase):
def test_subscript_load(self):
node = builder.extract_node("f[1]")
- self.assertIs(node.ctx, Load)
+ self.assertIs(node.ctx, Context.Load)
def test_subscript_del(self):
node = builder.extract_node("del f[1]")
- self.assertIs(node.targets[0].ctx, Del)
+ self.assertIs(node.targets[0].ctx, Context.Del)
def test_subscript_store(self):
node = builder.extract_node("f[1] = 2")
subscript = node.targets[0]
- self.assertIs(subscript.ctx, Store)
+ self.assertIs(subscript.ctx, Context.Store)
def test_list_load(self):
node = builder.extract_node("[]")
- self.assertIs(node.ctx, Load)
+ self.assertIs(node.ctx, Context.Load)
def test_list_del(self):
node = builder.extract_node("del []")
- self.assertIs(node.targets[0].ctx, Del)
+ self.assertIs(node.targets[0].ctx, Context.Del)
def test_list_store(self):
with self.assertRaises(AstroidSyntaxError):
@@ -953,7 +953,7 @@ class ContextTest(unittest.TestCase):
def test_tuple_load(self):
node = builder.extract_node("(1, )")
- self.assertIs(node.ctx, Load)
+ self.assertIs(node.ctx, Context.Load)
def test_tuple_store(self):
with self.assertRaises(AstroidSyntaxError):
@@ -962,12 +962,12 @@ class ContextTest(unittest.TestCase):
def test_starred_load(self):
node = builder.extract_node("a = *b")
starred = node.value
- self.assertIs(starred.ctx, Load)
+ self.assertIs(starred.ctx, Context.Load)
def test_starred_store(self):
node = builder.extract_node("a, *b = 1, 2")
starred = node.targets[0].elts[1]
- self.assertIs(starred.ctx, Store)
+ self.assertIs(starred.ctx, Context.Store)
def test_unknown():