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

IIIF / image-validator / 12285728456

11 Dec 2024 10:07PM UTC coverage: 40.498% (+2.5%) from 37.982%
12285728456

Pull #106

github

glenrobson
Moving to updating pypi via github actions
Pull Request #106: Adding github actions

699 of 1726 relevant lines covered (40.5%)

2.02 hits per line

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

41.67
/iiif_validator/tests/format_webp.py
1
from .test import BaseTest, ValidatorError
5✔
2
try:
5✔
3
    # python3
4
    from urllib.request import Request, urlopen, HTTPError
5✔
5
except ImportError:
×
6
    # fall back to python2
7
    from urllib2 import Request, urlopen, HTTPError
×
8

9
class Test_Format_Webp(BaseTest):
5✔
10
    label = 'WebP format'
5✔
11
    level = 3
5✔
12
    category = 6
5✔
13
    versions = [u'2.0', u'3.0']
5✔
14
    validationInfo = None
5✔
15

16
    def run(self, result):
5✔
17

18
        # chrs 8:12 == "WEBP"
19
        params = {'format': 'webp'}
×
20
        url = result.make_url(params)
×
21
        # Need as plain string for magic
22
        try:
×
23
            wh = urlopen(url)
×
24
        except HTTPError as error:    
×
25
            raise ValidatorError('format', 'http response code: {}'.format(error.code), url, result, 'Failed to retrieve webp, got response code {}'.format(error.code))
×
26
        img = wh.read()
×
27
        wh.close()
×
28
        if img[8:12] != "WEBP":
×
29
            raise ValidatorError('format', 'unknown', 'WEBP', result)
×
30
        else:
31
            result.tests.append('format')
×
32
            return result
×
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

© 2025 Coveralls, Inc