Coverage for genschema / comparators / delete_element.py: 100%

11 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-14 22:23 +0000

1from .template import Comparator, ComparatorResult, ProcessingContext, ToDelete 

2 

3 

4class DeleteElement(Comparator): 

5 """Визуально показывает где именно могут сработать компораторы""" 

6 

7 name = "delete-element" 

8 attribute = "" 

9 

10 def __init__(self, attribute: str = "j2sElementTrigger"): 

11 super().__init__() 

12 self.attribute = attribute 

13 

14 def can_process(self, ctx: ProcessingContext, env: str, node: dict) -> bool: 

15 # Обрабатываем объекты и массивы 

16 return self.attribute in node 

17 

18 def process(self, ctx: ProcessingContext, env: str, node: dict) -> ComparatorResult: 

19 return {self.attribute: ToDelete(node.get(self.attribute, -1), self)}, None