Coverage for src / check_datapackage / examples.py: 100%

8 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-04-02 14:17 +0000

1from textwrap import dedent 

2from typing import Any 

3 

4 

5def example_field_properties() -> dict[str, Any]: 

6 """Create a set of example field properties. 

7 

8 Returns: 

9 A set of example field properties. 

10 

11 Examples: 

12 ```{python} 

13 import check_datapackage as cdp 

14 

15 cdp.example_field_properties() 

16 ``` 

17 """ 

18 return { 

19 "name": "eye-colour", 

20 "type": "string", 

21 "title": "Woolly dormouse eye colour", 

22 } 

23 

24 

25def example_resource_properties() -> dict[str, Any]: 

26 """Create a set of example resource properties. 

27 

28 Returns: 

29 A set of example resource properties. 

30 

31 Examples: 

32 ```{python} 

33 import check_datapackage as cdp 

34 

35 cdp.example_resource_properties() 

36 ``` 

37 """ 

38 return { 

39 "name": "woolly-dormice-2015", 

40 "title": "Body fat percentage in the hibernating woolly dormouse", 

41 "path": "resources/woolly-dormice-2015/data.parquet", 

42 "schema": {"fields": [example_field_properties()]}, 

43 } 

44 

45 

46def example_package_properties() -> dict[str, Any]: 

47 """Create a set of example package properties. 

48 

49 Returns: 

50 A set of example package properties. 

51 

52 Examples: 

53 ```{python} 

54 import check_datapackage as cdp 

55 

56 cdp.example_package_properties() 

57 ``` 

58 """ 

59 return { 

60 "name": "woolly-dormice", 

61 "title": "Hibernation Physiology of the Woolly Dormouse: A Scoping Review.", 

62 "description": dedent(""" 

63 This scoping review explores the hibernation physiology of the 

64 woolly dormouse, drawing on data collected over a 10-year period 

65 along the Taurus Mountain range in Turkey. 

66 """), 

67 "id": "123-abc-123", 

68 "created": "2014-05-14T05:00:01+00:00", 

69 "version": "1.0.0", 

70 "licenses": [{"name": "odc-pddl"}], 

71 "resources": [example_resource_properties()], 

72 }