Coverage for fpdf2_textindex/interface/alias.py: 100.00%

12 statements  

« prev     ^ index     » next       coverage.py v7.14.1, created at 2026-06-01 14:22 +0000

1"""Alias.""" 

2 

3from __future__ import annotations 

4 

5import dataclasses 

6 

7from fpdf2_textindex.interface.abc import _LabelPathABC 

8from fpdf2_textindex.interface.label_path import LabelPath 

9 

10 

11@dataclasses.dataclass(frozen=True, kw_only=True, slots=True) 

12class Alias(_LabelPathABC): 

13 """Alias.""" 

14 

15 name: str 

16 """The name of the alias.""" 

17 

18 label_path: LabelPath 

19 """The label path of the alias.""" 

20 

21 def __post_init__(self) -> None: 

22 object.__setattr__(self, "label_path", LabelPath(self.label_path)) 

23 

24 def __repr__(self) -> str: 

25 return ( 

26 f"{type(self).__name__}" 

27 f"(#{self.name:s} -> {self.joined_label_path!r:s})" 

28 )