def test_not_external_function_requested(self): assert _parse_external(function_for_testing, function=True) == function_for_testing
def test_not_external_string(self): assert _parse_external('normal string') == 'normal string'
def test_not_external_function(self): assert _parse_external(function_for_testing) == function_for_testing
def test_invalid_functions(self, value, message): with pytest.raises(ValueError) as exc: _parse_external(value, function=True) assert re.search(message.format('a function'), exc.value.args[0])
def test_both_explicit_and_external_function(self): import itertools assert _parse_external('ext://itertools.chain', function=True) == itertools.chain
def test_external_function(self): import itertools assert _parse_external('itertools.chain', function=True) == itertools.chain
def test_explicit_external_function(self): import itertools assert _parse_external('ext://itertools.chain') == itertools.chain
def test_explicit_external_attribute(self): assert _parse_external('ext://sys.stdin') == sys.stdin