当前位置: 首页>>代码示例>>Python>>正文


Python ft2font.__freetype_version__方法代码示例

本文整理汇总了Python中matplotlib.ft2font.__freetype_version__方法的典型用法代码示例。如果您正苦于以下问题:Python ft2font.__freetype_version__方法的具体用法?Python ft2font.__freetype_version__怎么用?Python ft2font.__freetype_version__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在matplotlib.ft2font的用法示例。


在下文中一共展示了ft2font.__freetype_version__方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _init_tests

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def _init_tests():
    # CPython's faulthandler since v3.6 handles exceptions on Windows
    # https://bugs.python.org/issue23848 but until v3.6.4 it was printing
    # non-fatal exceptions https://bugs.python.org/issue30557
    import platform
    if not (sys.platform == 'win32' and
            (3, 6) < sys.version_info < (3, 6, 4) and
            platform.python_implementation() == 'CPython'):
        import faulthandler
        faulthandler.enable()

    # The version of FreeType to install locally for running the
    # tests.  This must match the value in `setupext.py`
    LOCAL_FREETYPE_VERSION = '2.6.1'

    from matplotlib import ft2font
    if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
        ft2font.__freetype_build_type__ != 'local'):
        _log.warning(
            "Matplotlib is not built with the correct FreeType version to run "
            "tests.  Set local_freetype=True in setup.cfg and rebuild. "
            "Expect many image comparison failures below. "
            "Expected freetype version {0}. "
            "Found freetype version {1}. "
            "Freetype build type is {2}local".format(
                LOCAL_FREETYPE_VERSION,
                ft2font.__freetype_version__,
                "" if ft2font.__freetype_build_type__ == 'local' else "not "))

    try:
        import pytest
    except ImportError:
        print("matplotlib.test requires pytest to run.")
        raise 
开发者ID:PacktPublishing,项目名称:Mastering-Elasticsearch-7.0,代码行数:36,代码来源:__init__.py

示例2: check_freetype_version

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def check_freetype_version(ver):
    if ver is None:
        return True

    from distutils import version
    if isinstance(ver, str):
        ver = (ver, ver)
    ver = [version.StrictVersion(x) for x in ver]
    found = version.StrictVersion(ft2font.__freetype_version__)

    return found >= ver[0] and found <= ver[1] 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:13,代码来源:decorators.py

示例3: check_freetype_version

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def check_freetype_version(ver):
    if ver is None:
        return True

    from distutils import version
    if isinstance(ver, six.string_types):
        ver = (ver, ver)
    ver = [version.StrictVersion(x) for x in ver]
    found = version.StrictVersion(ft2font.__freetype_version__)

    return found >= ver[0] and found <= ver[1] 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:13,代码来源:decorators.py

示例4: _init_tests

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def _init_tests():
    # CPython's faulthandler since v3.6 handles exceptions on Windows
    # https://bugs.python.org/issue23848 but until v3.6.4 it was printing
    # non-fatal exceptions https://bugs.python.org/issue30557
    import platform
    if not (sys.platform == 'win32' and
            (3, 6) < sys.version_info < (3, 6, 4) and
            platform.python_implementation() == 'CPython'):
        import faulthandler
        faulthandler.enable()

    # The version of FreeType to install locally for running the
    # tests.  This must match the value in `setupext.py`
    LOCAL_FREETYPE_VERSION = '2.6.1'

    from matplotlib import ft2font
    if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
        ft2font.__freetype_build_type__ != 'local'):
        warnings.warn(
            "Matplotlib is not built with the correct FreeType version to run "
            "tests.  Set local_freetype=True in setup.cfg and rebuild. "
            "Expect many image comparison failures below. "
            "Expected freetype version {0}. "
            "Found freetype version {1}. "
            "Freetype build type is {2}local".format(
                LOCAL_FREETYPE_VERSION,
                ft2font.__freetype_version__,
                "" if ft2font.__freetype_build_type__ == 'local' else "not "
            )
        )

    try:
        import pytest
    except ImportError:
        print("matplotlib.test requires pytest to run.")
        raise 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:38,代码来源:__init__.py

示例5: check_freetype_version

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def check_freetype_version(ver):
    if ver is None:
        return True

    if isinstance(ver, str):
        ver = (ver, ver)
    ver = [StrictVersion(x) for x in ver]
    found = StrictVersion(ft2font.__freetype_version__)

    return ver[0] <= found <= ver[1] 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:12,代码来源:decorators.py

示例6: _checked_on_freetype_version

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def _checked_on_freetype_version(required_freetype_version):
    import pytest
    reason = ("Mismatched version of freetype. "
              "Test requires '%s', you have '%s'" %
              (required_freetype_version, ft2font.__freetype_version__))
    return pytest.mark.xfail(
        not check_freetype_version(required_freetype_version),
        reason=reason, raises=ImageComparisonFailure, strict=False) 
开发者ID:Relph1119,项目名称:GraphicDesignPatternByPython,代码行数:10,代码来源:decorators.py

示例7: _checked_on_freetype_version

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def _checked_on_freetype_version(required_freetype_version):
    if check_freetype_version(required_freetype_version):
        return lambda f: f

    reason = ("Mismatched version of freetype. "
              "Test requires '%s', you have '%s'" %
              (required_freetype_version, ft2font.__freetype_version__))
    return _knownfailureif('indeterminate', msg=reason,
                           known_exception_class=ImageComparisonFailure) 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:11,代码来源:decorators.py

示例8: test

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def test(self):
        baseline_dir, result_dir = _image_directories(self._func)

        for fignum, baseline in zip(plt.get_fignums(), self._baseline_images):
            figure = plt.figure(fignum)

            for extension in self._extensions:
                will_fail = not extension in comparable_formats()
                if will_fail:
                    fail_msg = 'Cannot compare %s files on this system' % extension
                else:
                    fail_msg = 'No failure expected'

                orig_expected_fname = os.path.join(baseline_dir, baseline) + '.' + extension
                if extension == 'eps' and not os.path.exists(orig_expected_fname):
                    orig_expected_fname = os.path.join(baseline_dir, baseline) + '.pdf'
                expected_fname = make_test_filename(os.path.join(
                    result_dir, os.path.basename(orig_expected_fname)), 'expected')
                actual_fname = os.path.join(result_dir, baseline) + '.' + extension
                if os.path.exists(orig_expected_fname):
                    shutil.copyfile(orig_expected_fname, expected_fname)
                else:
                    will_fail = True
                    fail_msg = 'Do not have baseline image %s' % expected_fname

                @knownfailureif(
                    will_fail, fail_msg,
                    known_exception_class=ImageComparisonFailure)
                def do_test():
                    if self._remove_text:
                        self.remove_text(figure)

                    figure.savefig(actual_fname, **self._savefig_kwarg)

                    err = compare_images(expected_fname, actual_fname,
                                         self._tol, in_decorator=True)

                    try:
                        if not os.path.exists(expected_fname):
                            raise ImageComparisonFailure(
                                'image does not exist: %s' % expected_fname)

                        if err:
                            raise ImageComparisonFailure(
                                'images not close: %(actual)s vs. %(expected)s '
                                '(RMS %(rms).3f)'%err)
                    except ImageComparisonFailure:
                        if not check_freetype_version(self._freetype_version):
                            raise KnownFailureTest(
                                "Mismatched version of freetype.  Test requires '%s', you have '%s'" %
                                (self._freetype_version, ft2font.__freetype_version__))
                        raise

                yield (do_test,) 
开发者ID:Solid-Mechanics,项目名称:matplotlib-4-abaqus,代码行数:56,代码来源:decorators.py

示例9: test

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def test(self):
        baseline_dir, result_dir = _image_directories(self._func)

        for fignum, baseline in zip(plt.get_fignums(), self._baseline_images):
            for extension in self._extensions:
                will_fail = not extension in comparable_formats()
                if will_fail:
                    fail_msg = 'Cannot compare %s files on this system' % extension
                else:
                    fail_msg = 'No failure expected'

                orig_expected_fname = os.path.join(baseline_dir, baseline) + '.' + extension
                if extension == 'eps' and not os.path.exists(orig_expected_fname):
                    orig_expected_fname = os.path.join(baseline_dir, baseline) + '.pdf'
                expected_fname = make_test_filename(os.path.join(
                    result_dir, os.path.basename(orig_expected_fname)), 'expected')
                actual_fname = os.path.join(result_dir, baseline) + '.' + extension
                if os.path.exists(orig_expected_fname):
                    shutil.copyfile(orig_expected_fname, expected_fname)
                else:
                    will_fail = True
                    fail_msg = 'Do not have baseline image %s' % expected_fname

                @knownfailureif(
                    will_fail, fail_msg,
                    known_exception_class=ImageComparisonFailure)
                def do_test():
                    figure = plt.figure(fignum)

                    if self._remove_text:
                        self.remove_text(figure)

                    figure.savefig(actual_fname, **self._savefig_kwarg)

                    err = compare_images(expected_fname, actual_fname,
                                         self._tol, in_decorator=True)

                    try:
                        if not os.path.exists(expected_fname):
                            raise ImageComparisonFailure(
                                'image does not exist: %s' % expected_fname)

                        if err:
                            raise ImageComparisonFailure(
                                'images not close: %(actual)s vs. %(expected)s '
                                '(RMS %(rms).3f)'%err)
                    except ImageComparisonFailure:
                        if not check_freetype_version(self._freetype_version):
                            raise KnownFailureTest(
                                "Mismatched version of freetype.  Test requires '%s', you have '%s'" %
                                (self._freetype_version, ft2font.__freetype_version__))
                        raise

                yield (do_test,) 
开发者ID:miloharper,项目名称:neural-network-animation,代码行数:56,代码来源:decorators.py

示例10: test

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def test(self):
        baseline_dir, result_dir = _image_directories(self._func)

        for fignum, baseline in zip(plt.get_fignums(), self._baseline_images):
            for extension in self._extensions:
                will_fail = not extension in comparable_formats()
                if will_fail:
                    fail_msg = 'Cannot compare %s files on this system' % extension
                else:
                    fail_msg = 'No failure expected'

                orig_expected_fname = os.path.join(baseline_dir, baseline) + '.' + extension
                if extension == 'eps' and not os.path.exists(orig_expected_fname):
                    orig_expected_fname = os.path.join(baseline_dir, baseline) + '.pdf'
                expected_fname = make_test_filename(os.path.join(
                    result_dir, os.path.basename(orig_expected_fname)), 'expected')
                actual_fname = os.path.join(result_dir, baseline) + '.' + extension
                if os.path.exists(orig_expected_fname):
                    shutil.copyfile(orig_expected_fname, expected_fname)
                else:
                    will_fail = True
                    fail_msg = 'Do not have baseline image %s' % expected_fname

                @knownfailureif(
                    will_fail, fail_msg,
                    known_exception_class=ImageComparisonFailure)
                def do_test():
                    figure = plt.figure(fignum)

                    if self._remove_text:
                        self.remove_text(figure)

                    figure.savefig(actual_fname, **self._savefig_kwarg)

                    plt.close(figure)

                    err = compare_images(expected_fname, actual_fname,
                                         self._tol, in_decorator=True)

                    try:
                        if not os.path.exists(expected_fname):
                            raise ImageComparisonFailure(
                                'image does not exist: %s' % expected_fname)

                        if err:
                            # TODO: uri: Fix this miserable hack:
                            pass
                            #raise ImageComparisonFailure(
                                #'images not close: %(actual)s vs. '
                                #'%(expected)s (RMS %(rms).3f)' % err)
                    except ImageComparisonFailure:
                        if not check_freetype_version(self._freetype_version):
                            raise KnownFailure(
                                "Mismatched version of freetype.  Test requires '%s', you have '%s'" %
                                (self._freetype_version, ft2font.__freetype_version__))
                        raise

                yield (do_test,) 
开发者ID:urinieto,项目名称:msaf,代码行数:60,代码来源:mpl_ic.py

示例11: _init_tests

# 需要导入模块: from matplotlib import ft2font [as 别名]
# 或者: from matplotlib.ft2font import __freetype_version__ [as 别名]
def _init_tests():
    try:
        import faulthandler
    except ImportError:
        pass
    else:
        # CPython's faulthandler since v3.6 handles exceptions on Windows
        # https://bugs.python.org/issue23848 but until v3.6.4 it was
        # printing non-fatal exceptions https://bugs.python.org/issue30557
        import platform
        if not (sys.platform == 'win32' and
                (3, 6) < sys.version_info < (3, 6, 4) and
                platform.python_implementation() == 'CPython'):
            faulthandler.enable()

    # The version of FreeType to install locally for running the
    # tests.  This must match the value in `setupext.py`
    LOCAL_FREETYPE_VERSION = '2.6.1'

    from matplotlib import ft2font
    if (ft2font.__freetype_version__ != LOCAL_FREETYPE_VERSION or
        ft2font.__freetype_build_type__ != 'local'):
        warnings.warn(
            "Matplotlib is not built with the correct FreeType version to run "
            "tests.  Set local_freetype=True in setup.cfg and rebuild. "
            "Expect many image comparison failures below. "
            "Expected freetype version {0}. "
            "Found freetype version {1}. "
            "Freetype build type is {2}local".format(
                LOCAL_FREETYPE_VERSION,
                ft2font.__freetype_version__,
                "" if ft2font.__freetype_build_type__ == 'local' else "not "
            )
        )

    try:
        import pytest
        try:
            from unittest import mock
        except ImportError:
            import mock
    except ImportError:
        print("matplotlib.test requires pytest and mock to run.")
        raise 
开发者ID:alvarobartt,项目名称:twitter-stock-recommendation,代码行数:46,代码来源:__init__.py


注:本文中的matplotlib.ft2font.__freetype_version__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。