Coverage for adhoc-cicd-odoo-odoo / odoo / _monkeypatches / email.py: 81%

12 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-09 18:15 +0000

1from email._policybase import _PolicyBase 

2 

3 

4def patch_module(): 

5 def policy_clone(self, **kwargs): 

6 for arg in kwargs: 

7 if arg.startswith("_") or "__" in arg: 7 ↛ 8line 7 didn't jump to line 8 because the condition on line 7 was never true

8 raise AttributeError(f"{self.__class__.__name__!r} object has no attribute {arg!r}") 

9 return orig_policy_clone(self, **kwargs) 

10 

11 def policy_add(self, other): 

12 return policy_clone(self, **other.__dict__) 

13 

14 orig_policy_clone = _PolicyBase.clone 

15 _PolicyBase.clone = policy_clone 

16 _PolicyBase.__add__ = policy_add