Coverage for genschema / pseudo_arrays.py: 86%
14 statements
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-14 22:23 +0000
« prev ^ index » next coverage.py v7.13.4, created at 2026-03-14 22:23 +0000
1from typing import Optional
3from .comparators.template import ProcessingContext
6class PseudoArrayHandlerBase:
7 def is_pseudo_array(
8 self, keys: list[str], ctx: ProcessingContext
9 ) -> tuple[bool, Optional[str]]:
10 return False, None
13class PseudoArrayHandler(PseudoArrayHandlerBase):
14 def is_pseudo_array(
15 self, keys: list[str], ctx: ProcessingContext
16 ) -> tuple[bool, Optional[str]]:
17 if not keys:
18 return False, None
19 try:
20 [int(k) for k in keys]
21 return True, "^[0-9]+$"
22 except ValueError:
23 return False, None