diff --git a/attr/__init__.py b/attr/__init__.py index 648c7a4c..b8f58ed2 100644 --- a/attr/__init__.py +++ b/attr/__init__.py @@ -8,8 +8,8 @@ from ._funcs import ( has, ) from ._make import ( + _add_methods as s, _make_attr as ib, - s, ) __version__ = "0.0.0.dev0" diff --git a/attr/_make.py b/attr/_make.py index 4985f9ac..01325f92 100644 --- a/attr/_make.py +++ b/attr/_make.py @@ -83,11 +83,11 @@ def _get_attrs(cl): return attrs -def s(maybe_cl=None, add_repr=True, add_cmp=True, add_hash=True, - add_init=True): - # attrs_or class type depends on the usage of the decorator. - # It's a class if it's used as `@s` but ``None`` (or a value - # passed) if used as `@s()`. +def _add_methods(maybe_cl=None, add_repr=True, add_cmp=True, add_hash=True, + add_init=True): + # attrs_or class type depends on the usage of the decorator. It's a class + # if it's used as `@_add_methods` but ``None`` (or a value passed) if used + # as `@_add_methods()`. if isinstance(maybe_cl, type): cl = maybe_cl cl.__attrs_attrs__ = [ diff --git a/tests/test_funcs.py b/tests/test_funcs.py index c5a29c3c..4a964809 100644 --- a/tests/test_funcs.py +++ b/tests/test_funcs.py @@ -8,11 +8,11 @@ from attr._funcs import ls, has, to_dict from attr._make import ( Attribute, _make_attr, - s, + _add_methods, ) -@s +@_add_methods class C(object): x = _make_attr() y = _make_attr() @@ -42,7 +42,6 @@ class TestLs(object): """ Returns a list of `Attribute`. """ - assert all(isinstance(a, Attribute) for a in ls(C)) @@ -86,7 +85,7 @@ class TestHas(object): """ Returns `True` on decorated classes even if there are no attributes. """ - @s + @_add_methods class D(object): pass diff --git a/tests/test_make.py b/tests/test_make.py index 7bc2fc60..71f13bec 100644 --- a/tests/test_make.py +++ b/tests/test_make.py @@ -7,9 +7,9 @@ import pytest from attr._make import ( Attribute, _CountingAttr, + _add_methods, _get_attrs, _make_attr, - s, ) @@ -46,7 +46,7 @@ class TestGetAttrs(object): """ Returns attributes in correct order. """ - @s + @_add_methods class C(object): z = _make_attr() y = _make_attr() @@ -58,22 +58,22 @@ class TestGetAttrs(object): """ No attributes returns an empty list. """ - @s + @_add_methods class C(object): pass assert [] == _get_attrs(C) -class TestS(object): +class TestAddMethods(object): """ - Tests for the `s` class decorator. + Tests for the `_add_methods` class decorator. """ def test_sets_attrs(self): """ Sets the `__attrs_attrs__` class attribute with a list of `Attribute`s. """ - @s + @_add_methods class C(object): x = _make_attr() assert "x" == C.__attrs_attrs__[0].name @@ -83,7 +83,7 @@ class TestS(object): """ No attributes, no problems. """ - @s + @_add_methods class C3(object): pass assert "C3()" == repr(C3())