fixture.style

Utilities for deriving new names from existing names.

Style objects are used to customize how storable objects are found for DataSet objects

class fixture.style.Style

Utility for deriving new names from existing names.

each method receives a name and returns a new name.

guess_storable_name(name)
converts a dataset class name to a storage class name.
to_attr(name)
converts name to a new name suitable for an attribute.
class fixture.style.OriginalStyle

Bases: fixture.style.Style

Style that honors all original names.

class fixture.style.NamedDataStyle

Bases: fixture.style.TrimmedNameStyle

Derives names from datasets assuming “Data” as a suffix.

for example, consider this data object and this DataSet:

>>> class Author(object):
...     name = None
... 
>>> from fixture import DataSet
>>> class AuthorData(DataSet):
...     class freude:
...         name = "Sigmund Freude"
... 

if a LoadableFixture is configured with style=NamedDataStyle() then it will automatically look in its env for the object “Author” when loading the DataSet named “AuthorData”

class fixture.style.TrimmedNameStyle(prefix=None, suffix=None)

Bases: fixture.style.Style

Derives new names from trimming off prefixes/suffixes.

class fixture.style.PaddedNameStyle(prefix=None, suffix=None)

Bases: fixture.style.Style

Derives new names from padding names with prefixes/suffixes.

class fixture.style.CamelAndUndersStyle

Bases: fixture.style.Style

Style that assumes classes are already in came case but attributes should be underscore separated

guess_storable_name(name)

Assume a storage name is the same as original.

i.e. Employee becomes Employee

to_attr(name)

Derives lower case, underscored names from camel case class names.

i.e. EmployeeData translates to employee_data

Previous topic

fixture.loadable.storm_loadable

Next topic

fixture.util