Exemplo n.º 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()


###############################################################################
Exemplo n.º 2
0
    def get_all_hooks():
        """ Returns an iterator to the names of all evaluation hooks.
		"""
        for cls in get_subclasses(EvaluationHook):
            yield cls
Exemplo n.º 3
0
    def get_all_hooks():
        """ Returns an iterator to the names of all training hooks.
		"""
        for cls in get_subclasses(TrainingHook):
            yield cls
Exemplo n.º 4
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(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
Exemplo n.º 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):
Exemplo n.º 6
0
Arquivo: reader.py Projeto: dulaku/LIE
    def get_all_readers():
        """ Returns all Reader subclasses.
		"""
        for cls in get_subclasses(Reader):
            yield cls
Exemplo n.º 7
0
Arquivo: hooks.py Projeto: Navdevl/kur
	def get_all_hooks():
		""" Returns an iterator to the names of all training hooks.
		"""
		for cls in get_subclasses(TrainingHook):
			yield cls
Exemplo n.º 8
0
Arquivo: hooks.py Projeto: Navdevl/kur
	def get_all_hooks():
		""" Returns an iterator to the names of all evaluation hooks.
		"""
		for cls in get_subclasses(EvaluationHook):
			yield cls