The changes here add support for the @autodata, @fakedata, @autopandas, and @fakepandas in tests using pytest
The following syntax is now supported:
from autofaker import autodata, fakedata
@autodata(str)
def test_create_str_using_decorator(text):
assert text is not None
@autodata()
def test_create_str_using_decorator_with_type(text: str):
assert text is not None
@autodata(str, use_fake_data=True)
def test_create_str_using_decorator_with_fake_data(text):
assert text is not None@autodata(str, use_fake_data=True)
@fakedata()
def test_create_str_using_decorator_with_type_with_fake_data(text: str):
assert text is not None
You can also use classes and nested classes
from autofaker import autodata, fakedata
class SimpleClass:
id = -1
name = 'name'
text = 'test'
@autodata(SimpleClass)
def test_create_simple_class_using_decorator_returns_not_none(instance):
assert instance is not None
@autodata()
def test_create_simple_class_using_decorator_with_type_returns_not_none(instance: SimpleClass):
assert instance is not None
class NestedClass:
id = -1
name = 'name'
text = 'test'
inner = SimpleClass()
class DoubleNestedClass:
id = -1
name = 'name'
text = 'test'
inner = NestedClass()
@autodata(NestedClass)
def test_create_nested_class_using_decorator_returns_not_none(instance):
assert instance is not None
@autodata()
def test_create_nested_class_using_decorator_with_type_returns_not_none(instance: NestedClass):
assert instance is not None
This resolves #2
The changes here add support for the
@autodata
,@fakedata
,@autopandas
, and@fakepandas
in tests usingpytest
The following syntax is now supported:
You can also use classes and nested classes