Skip to content
10 changes: 8 additions & 2 deletions astroid/interpreter/objectmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,22 +467,28 @@ def attr___ne__(self):
attr___subclasshook__ = attr___ne__
attr___str__ = attr___ne__
attr___sizeof__ = attr___ne__
attr___setattr___ = attr___ne__
attr___setattr__ = attr___ne__
attr___repr__ = attr___ne__
attr___reduce__ = attr___ne__
attr___reduce_ex__ = attr___ne__
attr___lt__ = attr___ne__
attr___le__ = attr___ne__
attr___eq__ = attr___ne__
attr___ge__ = attr___ne__
attr___gt__ = attr___ne__
attr___format__ = attr___ne__
attr___delattr___ = attr___ne__
attr___delattr__ = attr___ne__
attr___getattribute__ = attr___ne__
attr___hash__ = attr___ne__
attr___dir__ = attr___ne__
attr___call__ = attr___ne__
attr___class__ = attr___ne__
attr___closure__ = attr___ne__
attr___code__ = attr___ne__
attr___builtins__ = attr___ne__
attr___getstate__ = attr___ne__
attr___init_subclass__ = attr___ne__
attr___type_params__ = attr___ne__


class ClassModel(ObjectModel):
Expand Down
22 changes: 14 additions & 8 deletions tests/test_object_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,13 @@ def test_module_model(self) -> None:
xml.__setattr__ #@
xml.__reduce_ex__ #@
xml.__lt__ #@
xml.__le__ #@
xml.__eq__ #@
xml.__ne__ #@
xml.__ge__ #@
xml.__gt__ #@
xml.__format__ #@
xml.__delattr___ #@
xml.__delattr__ #@
xml.__getattribute__ #@
xml.__hash__ #@
xml.__dir__ #@
Expand Down Expand Up @@ -326,7 +329,7 @@ def test_module_model(self) -> None:

# The following nodes are just here for theoretical completeness,
# and they either return Uninferable or raise InferenceError.
for ast_node in ast_nodes[11:28]:
for ast_node in ast_nodes[11:31]:
with pytest.raises(InferenceError):
next(ast_node.infer())

Expand Down Expand Up @@ -449,16 +452,23 @@ def func(a=1, b=2):

func.__reduce_ex__ #@
func.__lt__ #@
func.__le__ #@
func.__eq__ #@
func.__ne__ #@
func.__ge__ #@
func.__gt__ #@
func.__format__ #@
func.__delattr___ #@
func.__delattr__ #@
func.__getattribute__ #@
func.__hash__ #@
func.__dir__ #@
func.__class__ #@

func.__setattr__ #@
func.__builtins__ #@
func.__getstate__ #@
func.__init_subclass__ #@
func.__type_params__ #@
''',
module_name="fake_module",
)
Expand Down Expand Up @@ -513,14 +523,10 @@ def func(a=1, b=2):

# The following nodes are just here for theoretical completeness,
# and they either return Uninferable or raise InferenceError.
for ast_node in ast_nodes[11:26]:
for ast_node in ast_nodes[11:34]:
inferred = next(ast_node.infer())
assert inferred is util.Uninferable

for ast_node in ast_nodes[26:27]:
with pytest.raises(InferenceError):
inferred = next(ast_node.infer())

def test_empty_return_annotation(self) -> None:
ast_node = builder.extract_node(
"""
Expand Down