• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

IIIF / presentation-validator / 23324075654

20 Mar 2026 12:46AM UTC coverage: 77.088% (+2.2%) from 74.85%
23324075654

Pull #199

github

glenrobson
Cleaning up cli instructions
Pull Request #199: Refactoring and using uv

451 of 548 new or added lines in 10 files covered. (82.3%)

4 existing lines in 1 file now uncovered.

720 of 934 relevant lines covered (77.09%)

3.08 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

72.5
/presentation_validator/enum.py
1
from enum import Enum
4✔
2

3

4
class IIIFVersion(str, Enum):
4✔
5
    V1_0 = "1.0"
4✔
6
    V2_0 = "2.0"
4✔
7
    V2_1 = "2.1"
4✔
8
    V3_0 = "3.0"
4✔
9
    V4_0 = "4.0"
4✔
10

11
    DEFAULT = V3_0
4✔
12

13
    @classmethod
4✔
14
    def default(cls) -> "IIIFVersion":
4✔
15
        return cls.DEFAULT
4✔
16

17
    @classmethod
4✔
18
    def from_string(cls, value: str | None):
4✔
19
        if value is None:
4✔
NEW
20
            return None
×
21
        try:
4✔
22
            return cls(value)
4✔
NEW
23
        except ValueError:
×
NEW
24
            raise ValueError(f"Unsupported IIIF version: {value}")
×
25

26
    @classmethod
4✔
27
    def from_context(cls,context):
4✔
28
        if isinstance(context, list):
4✔
NEW
29
            context_str = context[-1]
×
30
        else:
31
            context_str = context
4✔
32

33
        # peak into the json to find the version
34
        if 'http://iiif.io/api/presentation/4/context.json' in context_str:
4✔
NEW
35
            version = IIIFVersion.V4_0
×
36
        elif 'http://iiif.io/api/presentation/3/context.json' in context_str:
4✔
NEW
37
            version = IIIFVersion.V3_0
×
38
        elif 'http://iiif.io/api/presentation/2/context.json' in context_str:
4✔
39
            version = IIIFVersion.V2_1
4✔
NEW
40
        elif 'http://www.shared-canvas.org/ns/context.json' in context_str:
×
NEW
41
            version = IIIFVersion.V1_0
×
42
        else:
NEW
43
            raise ValueError(f"Unsupported IIIF version: {context_str}")
×
44

45
        return version    
4✔
46

47
    @classmethod
4✔
48
    def values_str(cls) -> str:
4✔
NEW
49
        return ", ".join(v.value for v in cls)        
×
50

51
    @property
4✔
52
    def major(self) -> int:
4✔
NEW
53
        return int(self.value.split(".")[0])
×
54

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc