<commit_before>
Imports

    >>> from owslib.wmts import WebMapTileService
    
Fake a request to a WMTS Server using saved doc from 
http://server.caris.com/spatialfusionserver/services/ows/wmts/World/1.0.0/WMTSCapabilities.xml

    >>> xml = open('sfs-wmts-cap-world.xml', 'r').read() 
    >>> wmts = WebMapTileService('url', version='1.0.0', xml=xml)
    
Test capabilities
-----------------
    >>> wmts.identification.type
    'WMTS'
    >>> wmts.identification.version
    '1.0.0'
    >>> wmts.identification.title

    >>> wmts.identification.abstract

    >>> wmts.identification.keywords
    []
    >>> wmts.identification.accessconstraints
    'None'
    >>> wmts.identification.fees
    'conditions unknown'

Service Provider:

    >>> wmts.provider.name
    'CARIS'

    >>> wmts.provider.url
    
Check contact info
    >>> wmts.provider.contact.name
    '<NAME>'
    >>> wmts.provider.contact.position
    'Marketing & Sales Manager'

    # TODO: phone number
    >>> wmts.provider.contact.phone
    '1 (506) 459-3849'
    >>> wmts.provider.contact.address
    '115 Waggoners Lane'
    >>> wmts.provider.contact.region
    'New Brunswick'
    >>> wmts.provider.contact.email
    '<EMAIL>'
    >>> wmts.provider.contact.city
    'Fredericton'
    >>> wmts.provider.contact.postcode
    'E3B 2L4'
    >>> wmts.provider.contact.country
    'Canada'
    
Test available content layers

    >>> list(wmts.contents)
    ['World', 'Ocean']

Test TileMatrixSet variants

    >>> wmts.tilematrixsets.keys()
    ['GoogleMapsCompatible', 'GlobalCRS84Scale']
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].identifier
    'GoogleMapsCompatible'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].crs
    'urn:ogc:def:crs:EPSG:6.18:3:3857'
    >>> sorted(wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix.keys())
    ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '2', '3', '4', '5', '6', '7', '8', '9']
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].identifier
    '0'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].scaledenominator
    559082264.0287178
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].topleftcorner
    (-20037508.342789244, -20037508.342789244)
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].tilewidth
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].tileheight
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].matrixwidth
    1
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].matrixheight
    1
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].identifier
    '17'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].scaledenominator
    4265.459167699568
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].topleftcorner
    (-20037508.342789244, -20037508.342789244)
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].tilewidth
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].tileheight
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].matrixwidth
    131072
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].matrixheight
    131072

    >>> wmts.tilematrixsets['GlobalCRS84Scale'].identifier
    'GlobalCRS84Scale'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].crs
    'urn:ogc:def:crs:OGC:1.3:CRS84'
    >>> sorted(wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix.keys())
    ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '3', '4', '5', '6', '7', '8', '9']
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].identifier
    '0'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].scaledenominator
    500000000.0
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].topleftcorner
    (90.0, -180.0)
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].tilewidth
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].tileheight
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].matrixwidth
    2
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].matrixheight
    1
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].identifier
    '20'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].scaledenominator
    100.0
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].topleftcorner
    (90.0, -180.0)
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].tilewidth
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].tileheight
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].matrixwidth
    2097152
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].matrixheight
    1048576

Test single item accessor

    >>> wmts['World'].title
    'World'
    >>> wmts['World'].boundingBoxWGS84
    (-179.99999999999997, -90.0, 179.296876953125, 83.62700000000001)
    >>> wmts['World'].id
    'World'
    >>> wmts['World'].styles
    {'default': {'isDefault': True}}
    >>> wmts['World'].formats
    ['image/png']
    >>> wmts['World'].tilematrixsets
    ['GlobalCRS84Scale', 'GoogleMapsCompatible']
    >>> wmts['World'].infoformats
    ['application/gml+xml; version=3.1']
    #            <ResourceURL format="image/png" resourceType="tile" template="http://server.caris.com/spatialfusionserver/services/ows/wmts/World/World/default/{tileMatrixSet}/{tileMatrix}/{tileRow}/{tileCol}.png"/>
    #            <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo" template="http://server.caris.com/spatialfusionserver/services/ows/wmts/World/World/default/{tileMatrixSet}/{tileMatrix}/{tileRow}/{tileCol}/{j}/{i}.xml"/>

Expect a KeyError for invalid names

    >>> wmts['utterly bogus'].title
    Traceback (most recent call last):
    ...
    KeyError: 'No content named utterly bogus'

Test operations

    >>> [op.name for op in wmts.operations]
    ['GetTile', 'GetFeatureInfo', 'GetCapabilities']

    >>> wmts.getOperationByName('GetFeatureInfo').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}
    
    >>> wmts.getOperationByName('GetTile').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}

    >>> wmts.getOperationByName('GetCapabilities').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}


Test the gettile methods

    # TODO - more checks

Test the GetFeatureInfo operations

    #TODO - implement and check

<commit_msg>Fix missing newline - breaks a test<commit_after>
Imports

    >>> from owslib.wmts import WebMapTileService
    
Fake a request to a WMTS Server using saved doc from 
http://server.caris.com/spatialfusionserver/services/ows/wmts/World/1.0.0/WMTSCapabilities.xml

    >>> xml = open('sfs-wmts-cap-world.xml', 'r').read() 
    >>> wmts = WebMapTileService('url', version='1.0.0', xml=xml)
    
Test capabilities
-----------------
    >>> wmts.identification.type
    'WMTS'
    >>> wmts.identification.version
    '1.0.0'
    >>> wmts.identification.title

    >>> wmts.identification.abstract

    >>> wmts.identification.keywords
    []
    >>> wmts.identification.accessconstraints
    'None'
    >>> wmts.identification.fees
    'conditions unknown'

Service Provider:

    >>> wmts.provider.name
    'CARIS'

    >>> wmts.provider.url
    
Check contact info
    >>> wmts.provider.contact.name
    '<NAME>'
    >>> wmts.provider.contact.position
    'Marketing & Sales Manager'
    >>> wmts.provider.contact.phone
    '1 (506) 459-3849'
    >>> wmts.provider.contact.address
    '115 Waggoners Lane'
    >>> wmts.provider.contact.region
    'New Brunswick'
    >>> wmts.provider.contact.email
    '<EMAIL>'
    >>> wmts.provider.contact.city
    'Fredericton'
    >>> wmts.provider.contact.postcode
    'E3B 2L4'
    >>> wmts.provider.contact.country
    'Canada'
    
Test available content layers

    >>> list(wmts.contents)
    ['World', 'Ocean']

Test TileMatrixSet variants

    >>> wmts.tilematrixsets.keys()
    ['GoogleMapsCompatible', 'GlobalCRS84Scale']
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].identifier
    'GoogleMapsCompatible'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].crs
    'urn:ogc:def:crs:EPSG:6.18:3:3857'
    >>> sorted(wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix.keys())
    ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '2', '3', '4', '5', '6', '7', '8', '9']
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].identifier
    '0'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].scaledenominator
    559082264.0287178
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].topleftcorner
    (-20037508.342789244, -20037508.342789244)
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].tilewidth
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].tileheight
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].matrixwidth
    1
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['0'].matrixheight
    1
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].identifier
    '17'
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].scaledenominator
    4265.459167699568
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].topleftcorner
    (-20037508.342789244, -20037508.342789244)
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].tilewidth
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].tileheight
    256
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].matrixwidth
    131072
    >>> wmts.tilematrixsets['GoogleMapsCompatible'].tilematrix['17'].matrixheight
    131072

    >>> wmts.tilematrixsets['GlobalCRS84Scale'].identifier
    'GlobalCRS84Scale'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].crs
    'urn:ogc:def:crs:OGC:1.3:CRS84'
    >>> sorted(wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix.keys())
    ['0', '1', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '2', '20', '3', '4', '5', '6', '7', '8', '9']
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].identifier
    '0'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].scaledenominator
    500000000.0
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].topleftcorner
    (90.0, -180.0)
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].tilewidth
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].tileheight
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].matrixwidth
    2
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['0'].matrixheight
    1
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].identifier
    '20'
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].scaledenominator
    100.0
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].topleftcorner
    (90.0, -180.0)
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].tilewidth
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].tileheight
    256
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].matrixwidth
    2097152
    >>> wmts.tilematrixsets['GlobalCRS84Scale'].tilematrix['20'].matrixheight
    1048576

Test single item accessor

    >>> wmts['World'].title
    'World'
    >>> wmts['World'].boundingBoxWGS84
    (-179.99999999999997, -90.0, 179.296876953125, 83.62700000000001)
    >>> wmts['World'].id
    'World'
    >>> wmts['World'].styles
    {'default': {'isDefault': True}}
    >>> wmts['World'].formats
    ['image/png']
    >>> wmts['World'].tilematrixsets
    ['GlobalCRS84Scale', 'GoogleMapsCompatible']
    >>> wmts['World'].infoformats
    ['application/gml+xml; version=3.1']

   # TODO:
    #            <ResourceURL format="image/png" resourceType="tile" template="http://server.caris.com/spatialfusionserver/services/ows/wmts/World/World/default/{tileMatrixSet}/{tileMatrix}/{tileRow}/{tileCol}.png"/>
    #            <ResourceURL format="application/gml+xml; version=3.1" resourceType="FeatureInfo" template="http://server.caris.com/spatialfusionserver/services/ows/wmts/World/World/default/{tileMatrixSet}/{tileMatrix}/{tileRow}/{tileCol}/{j}/{i}.xml"/>

Expect a KeyError for invalid names

    >>> wmts['utterly bogus'].title
    Traceback (most recent call last):
    ...
    KeyError: 'No content named utterly bogus'

Test operations

    >>> [op.name for op in wmts.operations]
    ['GetTile', 'GetFeatureInfo', 'GetCapabilities']

    >>> wmts.getOperationByName('GetFeatureInfo').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}
    
    >>> wmts.getOperationByName('GetTile').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}

    >>> wmts.getOperationByName('GetCapabilities').methods
    {'Get': {'url': 'http://server.caris.com/spatialfusionserver/services/ows/wmts/World', 'encodings': ['KVP']}}


Test the gettile methods

    # TODO - more checks

Test the GetFeatureInfo operations

    #TODO - implement and check


{'fraction_non_alphanumeric': 0.18053711081599527, 'fraction_numerical': 0.06241699867197875, 'mean_word_length': 4.163809523809523, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 425, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 16}, 'pii_count': 0, 'substrings_counts': 6, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2635970', 'n_tokens_mistral': 5152, 'n_tokens_neox': 4664, 'n_words': 591}