Skip to content

Commit 85f3960

Browse files
blueyedolegpidsadnyi
authored andcommitted
Failing test for using a attributes field on the factory (#48)
``` cls = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'>, args = (), kwargs = {'create': True, 'extra': {'attributes': None}} @classmethod def attributes(cls, *args, **kwargs): return dict( (key, value) > for key, value in super(Factory, cls).attributes(*args, **kwargs).items() if key in data ) E TypeError: 'NoneType' object is not callable Factory = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'> __class__ = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'> args = () cls = <class 'pytest_factoryboy.fixture.model_fixture.<locals>.Factory'> data = {'attributes': None} kwargs = {'create': True, 'extra': {'attributes': None}} .tox/py36-pytest3/lib/python3.6/site-packages/pytest_factoryboy/fixture.py:184: TypeError ```
1 parent 2c866a5 commit 85f3960

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tests/test_attributes_field.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from pytest_factoryboy import register
2+
import factory
3+
4+
5+
class EmptyModel(object):
6+
pass
7+
8+
9+
class AttributesFactory(factory.Factory):
10+
class Meta:
11+
model = EmptyModel
12+
13+
attributes = None
14+
15+
16+
register(AttributesFactory, "with_attributes")
17+
18+
19+
def test_factory_with_attributes(with_attributes):
20+
"""Test that a factory can have a `attributes` field."""
21+
pass

0 commit comments

Comments
 (0)