예제 #1
0
###############################################################################
@pytest.fixture(params=enumerate_backends())
def a_backend(request):
    """ Fixture for obtaining a backend.
	"""
    cls = request.param
    if not cls.is_supported():
        pytest.xfail(
            'Backend {} is not installed and cannot be tested.'.format(
                cls.get_name()))
    return cls()


###############################################################################
@pytest.fixture(params=get_subclasses(Engine, recursive=True))
def an_engine(request):
    """ Fixture for obtaining an engine.
	"""
    return request.param()


###############################################################################
@pytest.fixture
def passthrough_engine():
    """ Returns a Jinja2 engine.
	"""
    return JinjaEngine()


###############################################################################
예제 #2
0
    def get_all_hooks():
        """ Returns an iterator to the names of all evaluation hooks.
		"""
        for cls in get_subclasses(EvaluationHook):
            yield cls
예제 #3
0
    def get_all_hooks():
        """ Returns an iterator to the names of all training hooks.
		"""
        for cls in get_subclasses(TrainingHook):
            yield cls
예제 #4
0
파일: conftest.py 프로젝트: Navdevl/kur
###############################################################################
@pytest.fixture(
	params=enumerate_backends()
)
def a_backend(request):
	""" Fixture for obtaining a backend.
	"""
	cls = request.param
	if not cls.is_supported():
		pytest.xfail('Backend {} is not installed and cannot be tested.'
			.format(cls.get_name()))
	return cls(device='cpu')

###############################################################################
@pytest.fixture(
	params=get_subclasses(Engine, recursive=True)
)
def an_engine(request):
	""" Fixture for obtaining an engine.
	"""
	return request.param()

###############################################################################
@pytest.fixture
def passthrough_engine():
	""" Returns a Jinja2 engine.
	"""
	return JinjaEngine()

###############################################################################
@pytest.fixture
예제 #5
0
###############################################################################
@pytest.fixture(
	params=enumerate_backends()
)
def a_backend(request):
	""" Fixture for obtaining a backend.
	"""
	cls = request.param
	if not cls.is_supported():
		pytest.xfail('Backend {} is not installed and cannot be tested.'
			.format(cls.get_name()))
	return cls()

###############################################################################
@pytest.fixture(
	params=get_subclasses(Engine, recursive=True)
)
def an_engine(request):
	""" Fixture for obtaining an engine.
	"""
	return request.param()

###############################################################################
@pytest.fixture
def jinja_engine():
	""" Returns a Jinja2 engine.
	"""
	return JinjaEngine()

###############################################################################
def model_with_containers(backend, containers):
예제 #6
0
파일: reader.py 프로젝트: dulaku/LIE
    def get_all_readers():
        """ Returns all Reader subclasses.
		"""
        for cls in get_subclasses(Reader):
            yield cls
예제 #7
0
파일: hooks.py 프로젝트: Navdevl/kur
	def get_all_hooks():
		""" Returns an iterator to the names of all training hooks.
		"""
		for cls in get_subclasses(TrainingHook):
			yield cls
예제 #8
0
파일: hooks.py 프로젝트: Navdevl/kur
	def get_all_hooks():
		""" Returns an iterator to the names of all evaluation hooks.
		"""
		for cls in get_subclasses(EvaluationHook):
			yield cls