コード例 #1
0
ファイル: test_style.py プロジェクト: movermeyer/pycnik
    def test_single_style(self):
        '''Should serialize a single style in a single layer'''
        xml = parse_resource('sample.py')

        assert_equal(len(xml.xpath('/Map/Layer/StyleName')), 1)
        style = xml.xpath('/Map/Layer/StyleName')[0]
        assert_equal(style.text, "world_My Style")
コード例 #2
0
ファイル: test_layers.py プロジェクト: movermeyer/pycnik
    def test_layers_ordering(self):
        '''Should parse a many layer tags in order'''
        xml = parse_resource('natural.py')
        layers = xml.xpath('/Map/Layer')

        assert_equal(len(layers), 2)
        assert_equal(layers[0].attrib['name'], 'natural_earth')
        assert_equal(layers[1].attrib['name'], 'country boundaries')
コード例 #3
0
    def test_preserve_order(self):
        '''Copy should preserve layer ordering'''
        xml = parse_resource('copy_all.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        layers = xml.xpath('/Map/Layer')
        assert_equal(layers[0].attrib['name'], 'natural_earth')
        assert_equal(layers[1].attrib['name'], 'country boundaries')
コード例 #4
0
ファイル: test_layers.py プロジェクト: movermeyer/pycnik
 def test_single_layer_tag(self):
     '''Should parse a single layer tag'''
     xml = parse_resource('sample.py')
     layers = xml.xpath('/Map/Layer')
     assert_equal(len(layers), 1)
     assert_equal(layers[0].attrib['name'], 'world')
     assert_equal(layers[0].attrib['srs'],
                  "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
コード例 #5
0
ファイル: test_style.py プロジェクト: movermeyer/pycnik
    def test_many_layer_single_style(self):
        '''Should serialize a single style in a many layers template'''
        xml = parse_resource('natural.py')

        path = '/Map/Layer[@name="natural_earth"]/StyleName'
        assert_equal(len(xml.xpath(path)), 1)
        style = xml.xpath(path)[0]
        assert_equal(style.text, "natural_earth_default")
コード例 #6
0
ファイル: test_layers.py プロジェクト: Mappy/pycnik
    def test_layers_ordering(self):
        '''Should parse a many layer tags in order'''
        xml = parse_resource('natural.py')
        layers = xml.xpath('/Map/Layer')

        assert_equal(len(layers), 2)
        assert_equal(layers[0].attrib['name'], 'natural_earth')
        assert_equal(layers[1].attrib['name'], 'country boundaries')
コード例 #7
0
ファイル: test_layers.py プロジェクト: Mappy/pycnik
 def test_single_layer_tag(self):
     '''Should parse a single layer tag'''
     xml = parse_resource('sample.py')
     layers = xml.xpath('/Map/Layer')
     assert_equal(len(layers), 1)
     assert_equal(layers[0].attrib['name'], 'world')
     assert_equal(layers[0].attrib['srs'],
         "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs")
コード例 #8
0
ファイル: test_copy.py プロジェクト: bboyrankingz/pycnik
    def test_copy_list(self):
        '''Should copy a list of feature'''
        xml = parse_resource('copy_list.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="natural_earth"]')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="country boundaries"]')), 0)
コード例 #9
0
ファイル: test_copy.py プロジェクト: bboyrankingz/pycnik
    def test_preserve_order(self):
        '''Copy should preserve layer ordering'''
        xml = parse_resource('copy_all.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        layers = xml.xpath('/Map/Layer')
        assert_equal(layers[0].attrib['name'], 'natural_earth')
        assert_equal(layers[1].attrib['name'], 'country boundaries')
コード例 #10
0
ファイル: test_copy.py プロジェクト: bboyrankingz/pycnik
    def test_copy_exclude(self):
        '''Should not copy excluded feature list'''
        xml = parse_resource('copy_exclude.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="natural_earth"]')), 0)
        assert_equal(len(xml.xpath('/Map/Layer[@name="country boundaries"]')), 1)
コード例 #11
0
    def test_copy_list(self):
        '''Should copy a list of feature'''
        xml = parse_resource('copy_list.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="natural_earth"]')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="country boundaries"]')),
                     0)
コード例 #12
0
    def test_copy_exclude(self):
        '''Should not copy excluded feature list'''
        xml = parse_resource('copy_exclude.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 1)
        assert_equal(len(xml.xpath('/Map/Layer[@name="natural_earth"]')), 0)
        assert_equal(len(xml.xpath('/Map/Layer[@name="country boundaries"]')),
                     1)
コード例 #13
0
ファイル: test_layers.py プロジェクト: movermeyer/pycnik
    def test_many_layer_tags(self):
        '''Should parse a many layer tags'''
        xml = parse_resource('natural.py')
        assert_equal(len(xml.xpath('/Map/Layer')), 2)

        natural_earth = xml.xpath('/Map/Layer[@name="natural_earth"]')[0]
        assert_equal(natural_earth.attrib['name'], 'natural_earth')
        assert_is_not_none(etree.SubElement(natural_earth, 'datasource'))

        boundaries = xml.xpath('/Map/Layer[@name="country boundaries"]')[0]
        assert_equal(boundaries.attrib['name'], 'country boundaries')
        assert_is_not_none(etree.SubElement(boundaries, 'datasource'))
コード例 #14
0
ファイル: test_layers.py プロジェクト: Mappy/pycnik
    def test_many_layer_tags(self):
        '''Should parse a many layer tags'''
        xml = parse_resource('natural.py')
        assert_equal(len(xml.xpath('/Map/Layer')), 2)

        natural_earth = xml.xpath('/Map/Layer[@name="natural_earth"]')[0]
        assert_equal(natural_earth.attrib['name'], 'natural_earth')
        assert_is_not_none(etree.SubElement(natural_earth, 'datasource'))

        boundaries = xml.xpath('/Map/Layer[@name="country boundaries"]')[0]
        assert_equal(boundaries.attrib['name'], 'country boundaries')
        assert_is_not_none(etree.SubElement(boundaries, 'datasource'))
コード例 #15
0
ファイル: test_copy.py プロジェクト: Mappy/pycnik
    def test_override(self):
        '''Copy should allow standard overriding'''
        xml = parse_resource('copy_all.py')
        node = xml.xpath('/Map')[0]
        assert_equal(node.attrib['background-color'], 'steelblue')
        assert_equal(node.attrib['srs'], "+init=epsg:4326")

        from lxml import etree
        print etree.tostring(xml, pretty_print=True)
        nodes = xml.xpath('/Map/Style[@name="natural_earth_default"]/Rule')
        assert_equal(len(nodes), 2)
        for node in nodes:
            if len(node.xpath('RasterSymbolizer')[0].attrib) == 2:
                assert_equal(node.xpath('RasterSymbolizer')[0].attrib['scaling'], 'fast')
            else:
                assert_equal(node.xpath('RasterSymbolizer')[0].attrib['scaling'], 'bilinear')
コード例 #16
0
    def test_override(self):
        '''Copy should allow standard overriding'''
        xml = parse_resource('copy_all.py')
        node = xml.xpath('/Map')[0]
        assert_equal(node.attrib['background-color'], 'steelblue')
        assert_equal(node.attrib['srs'], "+init=epsg:4326")

        from lxml import etree
        print etree.tostring(xml, pretty_print=True)
        nodes = xml.xpath('/Map/Style[@name="natural_earth_default"]/Rule')
        assert_equal(len(nodes), 2)
        for node in nodes:
            if len(node.xpath('RasterSymbolizer')[0].attrib) == 2:
                assert_equal(
                    node.xpath('RasterSymbolizer')[0].attrib['scaling'],
                    'fast')
            else:
                assert_equal(
                    node.xpath('RasterSymbolizer')[0].attrib['scaling'],
                    'bilinear')
コード例 #17
0
ファイル: test_map.py プロジェクト: movermeyer/pycnik
 def setup(self):
     self.xml = parse_resource('sample.py')
コード例 #18
0
ファイル: test_style.py プロジェクト: movermeyer/pycnik
 def test_same_symbolizer_inheritance(self):
     '''Should inherite same symbolizer in a single style'''
     xml = parse_resource('natural.py')
     assert_equal(len(xml.xpath('/Map/Style[@name="country boundaries_green"]/Rule[2]/LineSymbolizer')), 2)
     assert_equal(len(xml.xpath('/Map/Style[@name="country boundaries_green"]/Rule[1]/LineSymbolizer')), 2)
コード例 #19
0
ファイル: test_style.py プロジェクト: movermeyer/pycnik
 def test_linePatternSymbolizer_in_style(self):
     '''Should serialize linePatternSymbolizer'''
     xml = parse_resource('natural.py')
     assert_equal(len(xml.xpath('/Map/Style[@name="country boundaries_blue"]/Rule/LinePatternSymbolizer')), 2)
コード例 #20
0
ファイル: test_layers.py プロジェクト: Mappy/pycnik
 def test_layer_attribute(self):
     '''Should get layer attributes'''
     xml = parse_resource('natural.py')
     layers = xml.xpath('/Map/Layer')
     assert_equal(len(layers[1].attrib), 3)
     assert_equal(layers[1].attrib['buffer-size'], '0')
コード例 #21
0
 def setup(self):
     "set up test fixtures"
     self.xml = parse_resource('sample.py')
コード例 #22
0
    def test_copy_all(self):
        '''Should copy all features'''
        xml = parse_resource('copy_all.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 2)
コード例 #23
0
ファイル: test_layers.py プロジェクト: movermeyer/pycnik
 def test_layer_attribute(self):
     '''Should get layer attributes'''
     xml = parse_resource('natural.py')
     layers = xml.xpath('/Map/Layer')
     assert_equal(len(layers[1].attrib), 3)
     assert_equal(layers[1].attrib['buffer-size'], '0')
コード例 #24
0
ファイル: test_metawriter.py プロジェクト: movermeyer/pycnik
 def setup(self):
     "set up test fixtures"
     self.xml = parse_resource('metawriter.py')
コード例 #25
0
ファイル: test_copy.py プロジェクト: bboyrankingz/pycnik
    def test_copy_all(self):
        '''Should copy all features'''
        xml = parse_resource('copy_all.py')

        assert_equal(len(xml.xpath('/Map')), 1)
        assert_equal(len(xml.xpath('/Map/Layer')), 2)
コード例 #26
0
ファイル: test_datasource.py プロジェクト: rcommande/pycnik
 def setup(self):
     "set up test fixtures"
     self.xml = parse_resource("sample.py")