Skip to main content

Lightweight test data generation framework

Project description


Build Status

YAml Meta Binding microframework

Define schema for YAML documents a-la SQLAlchemy to read, write and manipulate data like a python object.

Basic example

from yamb import Literal, Nested, Collection, YAMBObject

class Address(YAMBObject):
    city = Literal(default='New York')
    street = Literal()

class Person(YAMBObject):
    name = Literal()
    phone = Literal()
    address = Nested(Address)

    def lives_close_to(self, another_person):
        return ==

class Phonebook(YAMBObject):
    title = Literal()
    people = Collection(Person)

friends = Phonebook(title='Friends', people=[])

friends.people.append(Person(name='Sue', phone='+12345', address=Address(street='Some blvd')))
sam = Person(name='Sam', phone='+123456', address=Address(city='London', street='Picadilly'))
friends.people += [sam]

with open('friends.yml', 'w') as f:

parsed = Phonebook._load(open('friends.yml'))

assert parsed.title == 'Friends'
assert parsed.people[0] == 'New York'
assert parsed.people[1].name == 'Sam'

Project details

Download files

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

Files for yamb, version 0.1
Filename, size File type Python version Upload date Hashes
Filename, size yamb-0.1.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page