How to use the multidict._compat.USE_CYTHON function in multidict

To help you get started, weโ€™ve selected a few multidict examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aio-libs / multidict / tests / test_copy.py View on Github external
    ids=(["MultiDict", "CIMultiDict"] if USE_CYTHON else [])
    + ["PyMultiDict", "PyCIMultiDict"],
)
def cls(request):
    return request.param
github aio-libs / multidict / tests / test_istr.py View on Github external
import gc
import sys

import pytest

from multidict._compat import USE_CYTHON
from multidict._multidict_py import istr as _istr  # noqa: E402

if USE_CYTHON:
    from multidict._multidict import istr


IMPLEMENTATION = getattr(sys, "implementation")  # to suppress mypy error


class IStrMixin:

    cls = NotImplemented

    def test_ctor(self):
        s = self.cls()
        assert "" == s

    def test_ctor_str(self):
        s = self.cls("aBcD")
github aio-libs / multidict / tests / test_abc.py View on Github external
    ids=(["MultiDict", "CIMultiDict"] if USE_CYTHON else [])
    + ["PyMultiDict", "PyCIMultiDict"],
)
def cls(request):
    return request.param
github aio-libs / multidict / tests / test_update.py View on Github external
    ids=(["MultiDict", "CIMultiDict"] if USE_CYTHON else [])
    + ["PyMultiDict", "PyCIMultiDict"],
)
def cls(request):
    return request.param
github aio-libs / multidict / tests / test_version.py View on Github external
import pytest

from multidict._compat import USE_CYTHON
from multidict._multidict_py import CIMultiDict as _CIMultiDict
from multidict._multidict_py import MultiDict as _MultiDict  # noqa: E402
from multidict._multidict_py import getversion as _getversion

if USE_CYTHON:
    from multidict._multidict import MultiDict, CIMultiDict, getversion


class VersionMixin:
    cls = NotImplemented

    def getver(self, md):
        raise NotImplementedError

    def test_getversion_bad_param(self):
        with pytest.raises(TypeError):
            self.getver(1)

    def test_ctor(self):
        m1 = self.cls()
        v1 = self.getver(m1)
github aio-libs / multidict / tests / gen_pickles.py View on Github external
def generate():
    if not USE_CYTHON:
        raise RuntimeError("Cython is required")
    for proto in range(pickle.HIGHEST_PROTOCOL + 1):
        for name in ("MultiDict", "CIMultiDict", "PyMultiDict", "PyCIMultiDict"):
            write(name, proto)
github aio-libs / multidict / tests / test_pickle.py View on Github external
    ids=(["MultiDictProxy", "CIMultiDictProxy"] if USE_CYTHON else [])
    + ["PyMultiDictProxy", "PyCIMultiDictProxy"],
)
def proxy_classes(request):
    return request.param