-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
804 additions
and
420 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import setuptools | ||
|
||
with open('docs/pypi.md', 'r', encoding='utf-8') as fh: | ||
with open("docs/pypi.md", "r", encoding="utf-8") as fh: | ||
long_description = fh.read() | ||
|
||
setuptools.setup( | ||
name='autofaker', | ||
version='0.1.0', | ||
url='https://github.com/christianhelle/autofaker', | ||
license='MIT License', | ||
name="autofaker", | ||
version="0.1.0", | ||
url="https://github.com/christianhelle/autofaker", | ||
license="MIT License", | ||
license_files=["LICENSE"], | ||
author='Christian Helle', | ||
author_email='christian.helle@outlook.com', | ||
description='Python library designed to minimize the setup/arrange phase of your unit tests', | ||
author="Christian Helle", | ||
author_email="christian.helle@outlook.com", | ||
description="Python library designed to minimize the setup/arrange phase of your unit tests", | ||
long_description=long_description, | ||
long_description_content_type='text/markdown', | ||
package_dir={'': 'src'}, | ||
packages=setuptools.find_packages(where='src'), | ||
python_requires='>=3.7', | ||
install_requires=['pandas', 'faker', 'typing_inspect'], | ||
long_description_content_type="text/markdown", | ||
package_dir={"": "src"}, | ||
packages=setuptools.find_packages(where="src"), | ||
python_requires=">=3.7", | ||
install_requires=["pandas", "faker", "typing_inspect"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,56 @@ | ||
from autofaker.builtins import ( | ||
IntegerGenerator, | ||
FloatGenerator, | ||
BooleanGenerator, | ||
ByteArrayGenerator, | ||
BytesGenerator, | ||
ComplexGenerator, | ||
FloatGenerator, | ||
IntegerGenerator, | ||
MemoryViewGenerator, | ||
RangeGenerator, | ||
BytesGenerator, | ||
ByteArrayGenerator, | ||
MemoryViewGenerator | ||
) | ||
from autofaker.fakes import FakeStringGenerator, StringGenerator, FakeIntegerGenerator | ||
from autofaker.fakes import FakeIntegerGenerator, FakeStringGenerator, StringGenerator | ||
|
||
|
||
class BuiltinTypeDataGeneratorFactory: | ||
@staticmethod | ||
def is_supported(type_name) -> bool: | ||
return type_name in [ | ||
'int', | ||
'str', | ||
'float', | ||
'complex', | ||
'bool', | ||
'range', | ||
'bytes', | ||
'bytearray', | ||
'memoryview' | ||
"int", | ||
"str", | ||
"float", | ||
"complex", | ||
"bool", | ||
"range", | ||
"bytes", | ||
"bytearray", | ||
"memoryview", | ||
] | ||
|
||
@staticmethod | ||
def create(type_name, field_name: str = None, use_fake_data: bool = False): | ||
if type_name == 'int': | ||
return FakeIntegerGenerator() \ | ||
if field_name is not None and use_fake_data is True \ | ||
if type_name == "int": | ||
return ( | ||
FakeIntegerGenerator() | ||
if field_name is not None and use_fake_data is True | ||
else IntegerGenerator() | ||
if type_name == 'str': | ||
return FakeStringGenerator(field_name) \ | ||
if field_name is not None and use_fake_data is True \ | ||
) | ||
if type_name == "str": | ||
return ( | ||
FakeStringGenerator(field_name) | ||
if field_name is not None and use_fake_data is True | ||
else StringGenerator() | ||
if type_name == 'float': | ||
) | ||
if type_name == "float": | ||
return FloatGenerator() | ||
if type_name == 'complex': | ||
if type_name == "complex": | ||
return ComplexGenerator() | ||
if type_name == 'bool': | ||
if type_name == "bool": | ||
return BooleanGenerator() | ||
if type_name == 'range': | ||
if type_name == "range": | ||
return RangeGenerator() | ||
if type_name == 'bytes': | ||
if type_name == "bytes": | ||
return BytesGenerator() | ||
if type_name == 'bytearray': | ||
if type_name == "bytearray": | ||
return ByteArrayGenerator() | ||
if type_name == 'memoryview': | ||
if type_name == "memoryview": | ||
return MemoryViewGenerator() |
Oops, something went wrong.