Coverage for debugobj_r.py: 53%

28 statements  

« prev     ^ index     » next       coverage.py v7.2.5, created at 2023-05-11 13:22 -0700

1from idlelib import rpc 

2 

3def remote_object_tree_item(item): 

4 wrapper = WrappedObjectTreeItem(item) 

5 oid = id(wrapper) 

6 rpc.objecttable[oid] = wrapper 

7 return oid 

8 

9class WrappedObjectTreeItem: 

10 # Lives in PYTHON subprocess 

11 

12 def __init__(self, item): 

13 self.__item = item 1b

14 

15 def __getattr__(self, name): 

16 value = getattr(self.__item, name) 1b

17 return value 1b

18 

19 def _GetSubList(self): 

20 sub_list = self.__item._GetSubList() 

21 return list(map(remote_object_tree_item, sub_list)) 

22 

23class StubObjectTreeItem: 

24 # Lives in IDLE process 

25 

26 def __init__(self, sockio, oid): 

27 self.sockio = sockio 1c

28 self.oid = oid 1c

29 

30 def __getattr__(self, name): 

31 value = rpc.MethodProxy(self.sockio, self.oid, name) 

32 return value 

33 

34 def _GetSubList(self): 

35 sub_list = self.sockio.remotecall(self.oid, "_GetSubList", (), {}) 

36 return [StubObjectTreeItem(self.sockio, oid) for oid in sub_list] 

37 

38 

39if __name__ == '__main__': 39 ↛ 40line 39 didn't jump to line 40, because the condition on line 39 was never true

40 from unittest import main 

41 main('idlelib.idle_test.test_debugobj_r', verbosity=2)