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>'
def test_identifier_unnamed(): d = dict() assert _identifier(d) == '"unnamed_{}"<dict>'.format(id(d))
def test_identifier__name(): def normal_func(): pass # pragma: no cover assert _identifier(normal_func) == '"normal_func"<function>'
def test_identifier_attr(): pipeline = Pipeline(lambda: 1, _name="cool_pipeline") assert _identifier(pipeline) == '"cool_pipeline"<Pipeline>'