diff --git a/tests/test_dunders.py b/tests/test_dunders.py index 5ae6f4db..85c9309b 100644 --- a/tests/test_dunders.py +++ b/tests/test_dunders.py @@ -836,6 +836,29 @@ class TestAddInit: assert [] == i.a assert isinstance(i.b, D) + def test_factory_takes_self(self): + """ + If takes_self on factories is True, self is passed. + """ + C = make_class( + "C", + { + "x": attr.ib( + default=Factory((lambda self: self), takes_self=True) + ) + }, + ) + + i = C() + + assert i is i.x + + def test_factory_hashable(self): + """ + Factory is hashable. + """ + assert hash(Factory(None, False)) == hash(Factory(None, False)) + def test_validator(self): """ If a validator is passed, call it with the preliminary instance, the diff --git a/tests/test_make.py b/tests/test_make.py index e0e0aa96..736ab8cf 100644 --- a/tests/test_make.py +++ b/tests/test_make.py @@ -1336,29 +1336,6 @@ class TestConverter: assert c.x == val + 1 assert c.y == 2 - def test_factory_takes_self(self): - """ - If takes_self on factories is True, self is passed. - """ - C = make_class( - "C", - { - "x": attr.ib( - default=Factory((lambda self: self), takes_self=True) - ) - }, - ) - - i = C() - - assert i is i.x - - def test_factory_hashable(self): - """ - Factory is hashable. - """ - assert hash(Factory(None, False)) == hash(Factory(None, False)) - def test_convert_before_validate(self): """ Validation happens after conversion.