Skip to content

Commit 9e78982

Browse files
committed
Add unittest for property inference postinit
1 parent cb33cb7 commit 9e78982

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/unittest_brain_builtin.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2+
# For details: https://github.com/PyCQA/astroid/blob/main/LICENSE
3+
"""Unit Tests for the builtins brain module."""
4+
5+
import unittest
6+
7+
from astroid import extract_node, objects
8+
9+
class BuiltinsTest(unittest.TestCase):
10+
def test_infer_property(self):
11+
class_with_property = extract_node(
12+
"""
13+
class Something:
14+
def getter():
15+
return 5
16+
asd = property(getter) #@
17+
"""
18+
)
19+
inferred_property = list(class_with_property.value.infer())[0]
20+
assert isinstance(inferred_property, objects.Property)
21+
assert hasattr(inferred_property, "args")

0 commit comments

Comments
 (0)