Coverage for src / rendercv / schema / models / cv / entries / education.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-03-25 13:49 +0000

1import pydantic 

2 

3from .bases.entry import BaseEntry 

4from .bases.entry_with_complex_fields import BaseEntryWithComplexFields 

5 

6 

7class BaseEducationEntry(BaseEntry): 

8 """Education entry fields without date and complex fields. 

9 

10 Why: 

11 Separating education-specific fields (institution, area, degree) from 

12 date/location fields enables EducationEntry to inherit from both this 

13 class and BaseEntryWithComplexFields, controlling field ordering in 

14 the final model so institution/area/degree appear before dates. 

15 """ 

16 

17 institution: str = pydantic.Field( 

18 examples=["Boğaziçi University", "MIT", "Harvard University"], 

19 ) 

20 area: str = pydantic.Field( 

21 description="Field of study or major.", 

22 examples=[ 

23 "Mechanical Engineering", 

24 "Computer Science", 

25 "Electrical Engineering", 

26 ], 

27 ) 

28 degree: str | None = pydantic.Field( 

29 default=None, 

30 examples=["BS", "BA", "PhD", "MS"], 

31 ) 

32 

33 

34# This approach ensures EducationEntryBase keys appear first in the key order: 

35class EducationEntry(BaseEntryWithComplexFields, BaseEducationEntry): 

36 pass