Coverage for src/lektor_ng/types/fake.py: 68%

22 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-09-05 15:22 +0000

1from lektor_ng.constants import PRIMARY_ALT 

2from lektor_ng.i18n import get_i18n_block 

3from lektor_ng.types.base import Type 

4 

5 

6class FakeType(Type): 

7 def value_from_raw(self, raw): 

8 return None 

9 

10 def to_json(self, pad, record=None, alt=PRIMARY_ALT): 

11 rv = Type.to_json(self, pad, record, alt) 

12 rv["is_fake_type"] = True 

13 return rv 

14 

15 

16class LineType(FakeType): 

17 widget = "f-line" 

18 

19 

20class SpacingType(FakeType): 

21 widget = "f-spacing" 

22 

23 

24class InfoType(FakeType): 

25 widget = "f-info" 

26 

27 

28class HeadingType(FakeType): 

29 widget = "f-heading" 

30 

31 def to_json(self, pad, record=None, alt=PRIMARY_ALT): 

32 rv = FakeType.to_json(self, pad, record, alt) 

33 rv["heading_i18n"] = get_i18n_block(self.options, "heading") 

34 return rv