Skip to main content

DEPRECATED — This package is no longer maintained. Migrate to surety: pip install surety

Replace from fild.sdk import ... with from surety import ....

Downloads Python Versions License Build Status

FILD is a lightweight Python library for automated contract testing. FILD allows to store descriptive structure of the API and use it further for generating test data based on Faker.

The basic type for usage is Field, any other types should inherit from. Field supports the description of the API parameter within the following:
name: key in json
required: identifies the necessity of presense of the key in the resulting json.
allow_none: should be true if the value can be null in the json.
default: default value to be used in regular generation. Can either be the value or the callable to generate.

Abstract method generate_value is used to specify the rules based on which the value should be generated. When defining new type, inherited from Field, the method should be overriden to describe the generation procedure.

Library supports multi-level hierarchy with Arrays and Dictionaries.

Library also provides some dict operating methods.
filter_dict: allows to apply value/callable filter to dict by values
merge_with_updates: merges two dicts with either overriding or only adding values to the target dictionary.
normalize: sorts lists - both top level and embeded - to represent the desired order.

Examples

Field object is used to describe data structures

from fild.sdk import Dictionary, Enum, Int, String, Uuid


class Gender(Enum):
    Male = 'male'
    Femail = 'female'
    Other = 'other'


class Customer(Dictionary):
    Id = Uuid(name='id')
    Name = String(name='name', max_len=100)
    Age = Int(name='age', min_val=18, max_val=120)
    Gender = Gender(name='gender', required=False)
    Email = String(name='email')

Based on the description the data can be generated by calling constructor with or without parameters

generated_customer = Customer()
generated_full_customer = Customer(is_full=True)

Install from PyPI

Release files for fild 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fild 0.1.11
File Size Uploaded
fild-0.1.11.tar.gz 25.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fild 0.1.11
File Interpreter ABI Platform
fild-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 41.2 kB

Release files / fild-0.1.11.tar.gz

Download URL fild-0.1.11.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
7c4926bd46fc335dc3444efb0cca81826bef1700a1dea68580fb5ee646b102b2
BLAKE2b-256 checksum
How to use checksums
46b57e277f3550efa717ce2d1df243f2f3b3924f9744b4e446f5ea02ae550545
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / fild-0.1.11-py3-none-any.whl

Download URL fild-0.1.11-py3-none-any.whl
Size 15.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bbc391e512069ee6229d292ebd5fa7600484a1a5740185836c49fa7e1dc6fbc5
BLAKE2b-256 checksum
How to use checksums
337288ef1d994e1999c2bc49b17a0ea0e04a6c14c94ad562e038e2cdd6a46e8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page