From 8ff0337063e32b6cb830950d1152d256f41f872e Mon Sep 17 00:00:00 2001 From: eirannejad Date: Thu, 14 Nov 2024 11:38:02 -0800 Subject: [PATCH] updated tests --- tests/test_method_getattribute.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/tests/test_method_getattribute.py b/tests/test_method_getattribute.py index 57e7a7b27..cde62b171 100644 --- a/tests/test_method_getattribute.py +++ b/tests/test_method_getattribute.py @@ -4,13 +4,36 @@ def test_instance_get_dict(): - class T: + from Python.Test import ClassTest + class T(ClassTest): pass t = T() assert isinstance(t.__dict__, dict) +def test_instance_get_dict_with_type_field(): + from Python.Test import ClassTest + from types import MappingProxyType + class T(ClassTest): + type_field = 42 + pass + + assert isinstance(T.__dict__, MappingProxyType) + assert 'type_field' in T.__dict__ + + +def test_instance_get_dict_with_instance_field(): + from Python.Test import ClassTest + class T(ClassTest): + def __init__(self): + self.instance_field = 42 + + t = T() + assert isinstance(t.__dict__, dict) + assert 'instance_field' in t.__dict__ + + def test_method_getattribute(): class S1(BASE): def __getattribute__(self, name):