示例#1
0
def test_identifier_name():
    class PrivateName:
        def __init__(self, _name):
            super().__init__()
            self._name = _name

    private_name = PrivateName(_name="secret_name")
    assert _identifier(private_name) == '"secret_name"<PrivateName>'
示例#2
0
def test_identifier_unnamed():
    d = dict()
    assert _identifier(d) == '"unnamed_{}"<dict>'.format(id(d))
示例#3
0
def test_identifier__name():
    def normal_func():
        pass  # pragma: no cover

    assert _identifier(normal_func) == '"normal_func"<function>'
示例#4
0
def test_identifier_attr():
    pipeline = Pipeline(lambda: 1, _name="cool_pipeline")
    assert _identifier(pipeline) == '"cool_pipeline"<Pipeline>'