Skip to main content

fixturebuilder_py

Install

$ pip install fixturebuilder

Usage

# define the data structure to be worked on
start_data = {
    'prop1': 'value1',
    'prop2': 'value2',
    'dict1': {
        'dictprop1': 'dictvalue1'
    },
    'list1': [
        'listvalue1',
        'listvalue2'
    ],
    'list2': [
        {'listdictprop1': 'listdictprop1', 'listdictlist1': ['listdictlistvalue1']}
    ]
}

# initialize a new builder
builder = FixtureBulder.create(start_data)

# retrieve the data unchanged
test_data1 = builder.data

# set a new value on a property and retrieve the updated data
test_data2 = builder.set('prop1', 1).data

# do complex manipulation on the start_data and retrieve the modified data
test_data3 = builder
    .with_dict('dict1')  # descend into 'dict1' and work on it's properties
        .set('dictprop1', 12)
        .set('newlist', ['value'])
        .add('newlist', 'additional value')  # add a new value to a list
        .set('newdict', {'someprop': 'some value'})
        .with_dict('newdict')
            .set('someprop', 'change previously created value')
        .done()  # finish working on 'newdict' and return to 'dict1'
    .done()  # finish working on 'dict1' and return to the root
    .data


test_data4 = builder
    .duplicate_last_list_entry('list2')  # append a duplicated dict to the list
    .with_dict_list_element('list2')     # descend into the last list element to work on it's properties
        .add('listdictlist1', 'new value1')
        .set('listdictprop1', False)
    .done()  # finish working on the list element and return to the root
    .data

# retrieve the original unmodified data
original_data = builder.data

# setting new property raises an error
builder.set('newprop', 'newvalue')

Metadata

Release files for fixturebuilder_py 1.2.9

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

Source distribution (sdist)

Source distribution for fixturebuilder_py 1.2.9
File Size Uploaded Provenance Actions
fixturebuilder_py-1.2.9.tar.gz 6.3 kB Without provenance Details for fixturebuilder_py-1.2.9.tar.gz

Release files / fixturebuilder_py-1.2.9.tar.gz

Download URL fixturebuilder_py-1.2.9.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c1460bd436a1922485461e180dc1dc632e7b45ab0616911a2dc64e3c67165353
BLAKE2b-256 checksum
How to use checksums
94fe2ed5fb8c8f51960ce087c147e42110b05f645f27dbe3d33d56fa2b860718
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for fixturebuilder_py 1.2.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.2.9 This release

1 release file No provenance

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