Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(167)  |  Call(136)  |  Derive(0)  |  Import(31)

src/m/a/MapProxy-1.6.0/mapproxy/test/unit/test_image.py   MapProxy(Download)
from mapproxy.image.tile import TileMerger, TileSplitter
from mapproxy.image.transform import ImageTransformer
from mapproxy.test.image import is_png, is_jpeg, is_tiff, create_tmp_image_file, check_format, create_debug_img, create_image
from mapproxy.srs import SRS
from nose.tools import eq_
    def test_from_filename(self):
        ir = ImageSource(self.tmp_filename, PNG_FORMAT)
        assert is_png(ir.as_buffer())
        assert ir.as_image().size == (100, 100)
 
    def test_from_image(self):
        img = Image.new('RGBA', (100, 100))
        ir = ImageSource(img, (100, 100), PNG_FORMAT)
        assert ir.as_image() == img
        assert is_png(ir.as_buffer())
    def test_converted_output(self):
        ir = ImageSource(self.tmp_filename, (100, 100), PNG_FORMAT)
        assert is_png(ir.as_buffer())
        assert is_jpeg(ir.as_buffer(JPEG_FORMAT))
        assert is_jpeg(ir.as_buffer())

src/m/a/mapproxy-HEAD/mapproxy/test/unit/test_image.py   mapproxy(Download)
from mapproxy.image.tile import TileMerger, TileSplitter
from mapproxy.image.transform import ImageTransformer
from mapproxy.test.image import is_png, is_jpeg, is_tiff, create_tmp_image_file, check_format, create_debug_img, create_image
from mapproxy.srs import SRS
from nose.tools import eq_
    def test_from_filename(self):
        ir = ImageSource(self.tmp_filename, PNG_FORMAT)
        assert is_png(ir.as_buffer())
        assert ir.as_image().size == (100, 100)
 
    def test_from_image(self):
        img = Image.new('RGBA', (100, 100))
        ir = ImageSource(img, (100, 100), PNG_FORMAT)
        assert ir.as_image() == img
        assert is_png(ir.as_buffer())
    def test_converted_output(self):
        ir = ImageSource(self.tmp_filename, (100, 100), PNG_FORMAT)
        assert is_png(ir.as_buffer())
        assert is_jpeg(ir.as_buffer(JPEG_FORMAT))
        assert is_jpeg(ir.as_buffer())

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_wms.py   MapProxy(Download)
                                 WMS110CapabilitiesRequest, \
                                 wms_request
from mapproxy.test.image import is_jpeg, is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.helper import validate_with_dtd, validate_with_xsd
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_format(self):
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_format_options_img_exception(self):
        self.common_map_req.params['format'] = 'image/png; mode=12bit'
        self.common_map_req.params['exceptions'] = 'application/vnd.ogc.se_inimage'
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_srs(self):

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_wms_srs_extent.py   mapproxy(Download)
 
from mapproxy.test.system import module_setup, module_teardown, SystemTest, make_base_config
from mapproxy.test.image import is_png, is_transparent
from mapproxy.test.image import tmp_image, assert_colors_equal, img_from_buf
from mapproxy.test.http import mock_httpd
        # empty/transparent response
        eq_(resp.content_type, 'image/png')
        assert is_png(resp.body)
        assert is_transparent(resp.body)
 
        # red response
        eq_(resp.content_type, 'image/png')
        assert is_png(resp.body)
        assert_colors_equal(img_from_buf(resp.body).convert('RGBA'),
                [(100 * 100, [255, 0, 0, 255])])
                '&VERSION=1.1.0&TRANSPARENT=TRUE')
            eq_(resp.content_type, 'image/png')
            assert is_png(resp.body)
            colors = sorted(img_from_buf(resp.body).convert('RGBA').getcolors())
            # quarter is clipped, check if it's transparent
                '&VERSION=1.1.0&TRANSPARENT=FALSE&BGCOLOR=0x00ff00')
            eq_(resp.content_type, 'image/png')
            assert is_png(resp.body)
            assert_colors_equal(img_from_buf(resp.body).convert('RGBA'),
                [(50 * 100, [255, 0, 0, 255]), (50 * 100, [0, 255, 0, 255])])

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_wms.py   mapproxy(Download)
                                 WMS110CapabilitiesRequest, \
                                 wms_request
from mapproxy.test.image import is_jpeg, is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.helper import validate_with_dtd, validate_with_xsd
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_format(self):
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_format_options_img_exception(self):
        self.common_map_req.params['format'] = 'image/png; mode=12bit'
        self.common_map_req.params['exceptions'] = 'application/vnd.ogc.se_inimage'
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
        resp = self.app.get(self.common_map_req)
        eq_(resp.content_type, 'image/png')
        assert is_png(StringIO(resp.body))
 
    def test_invalid_srs(self):

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_combined_sources.py   MapProxy(Download)
from mapproxy.request.wms import WMS111MapRequest
from mapproxy.platform.image import Image
from mapproxy.test.image import is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system import module_setup, module_teardown, SystemTest
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_uncombined(self):
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_combined_layers(self):
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_layers_with_opacity(self):
            eq_(resp.content_type, 'image/png')
            data = StringIO(resp.body)
            assert is_png(data)
            img = Image.open(data)
            eq_(img.getcolors()[0], ((200*200),(127, 0, 64)))

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_combined_sources.py   mapproxy(Download)
from mapproxy.request.wms import WMS111MapRequest
from mapproxy.platform.image import Image
from mapproxy.test.image import is_png, tmp_image, create_tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system import module_setup, module_teardown, SystemTest
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_uncombined(self):
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_combined_layers(self):
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
 
    def test_layers_with_opacity(self):
            eq_(resp.content_type, 'image/png')
            data = StringIO(resp.body)
            assert is_png(data)
            img = Image.open(data)
            eq_(img.getcolors()[0], ((200*200),(127, 0, 64)))

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_scalehints.py   MapProxy(Download)
 
from mapproxy.test.system import module_setup, module_teardown, make_base_config, SystemTest
from mapproxy.test.image import is_png, is_transparent, tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system.test_wms import is_111_capa, is_130_capa, ns130
    def test_get_map_above_res(self):
        # no layer rendered
        resp = self.app.get(self.common_map_req)
        assert is_png(resp.body)
        assert is_transparent(resp.body)
            with mock_httpd(('localhost', 42423), [expected_req]):
                resp = self.app.get(self.common_map_req)
                assert is_png(resp.body)
                assert not is_transparent(resp.body)
 

src/m/a/mapproxy-HEAD/mapproxy/test/system/test_scalehints.py   mapproxy(Download)
 
from mapproxy.test.system import module_setup, module_teardown, make_base_config, SystemTest
from mapproxy.test.image import is_png, is_transparent, tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.system.test_wms import is_111_capa, is_130_capa, ns130
    def test_get_map_above_res(self):
        # no layer rendered
        resp = self.app.get(self.common_map_req)
        assert is_png(resp.body)
        assert is_transparent(resp.body)
            with mock_httpd(('localhost', 42423), [expected_req]):
                resp = self.app.get(self.common_map_req)
                assert is_png(resp.body)
                assert not is_transparent(resp.body)
 

src/m/a/MapProxy-1.6.0/mapproxy/test/system/test_legendgraphic.py   MapProxy(Download)
 
from mapproxy.test.system import module_setup, module_teardown, make_base_config, SystemTest
from mapproxy.test.image import is_png, tmp_image
from mapproxy.test.http import mock_httpd
from mapproxy.test.helper import validate_with_dtd, validate_with_xsd
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
                assert Image.open(data).size == (256,768)
 
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
                assert Image.open(data).size == (256,256)
 
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
                assert Image.open(data).size == (256,256)
 
                eq_(resp.content_type, 'image/png')
                data = StringIO(resp.body)
                assert is_png(data)
                assert Image.open(data).size == (256,512)
 

  1 | 2 | 3 | 4  Next