Skip to main content

Generating test data structures

Project description

Your welcome <3

Description

Sgen is a tool for generating test data structures in Python.

from pprint import pprint

from sgen import Sgen, fields


class Pet(SGen):
    name = fields.String()


class User(SGen):
    name = fields.String()
    pet = fields.Nested(Pet(), required=True)


def main():
    datasets = list(User().positive())

    pprint(datasets, indent=2)


if __name__ == '__main__':
    main()

# [ {'name': None, 'pet': {'name': None}},
#   {'name': None, 'pet': {}},
#   {'name': None, 'pet': {'name': 'fszxSnf'}},
#   {'pet': {'name': None}},
#   {'pet': {}},
#   {'pet': {'name': 'RzGTdNzhr'}},
#   {'name': 'ttr', 'pet': {'name': None}},
#   {'name': 'ttr', 'pet': {}},
#   {'name': 'ttr', 'pet': {'name': 'ZpvMOyR'}}]

In short, SGen can be used to:

  • Generating positive data structures

  • Generating negative data structures

  • Checking the functionality of data validation at the application input

Get It Now

pip install sgen

Documentation

Full documentation is available at here

Requirements

  • Python >= 3.8

License

  • MIT licensed.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sgen-1.0.2.tar.gz (12.6 kB view hashes)

Uploaded Source

Built Distribution

sgen-1.0.2-py3-none-any.whl (8.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page