Skip to content

Transformer not used with trait and value override #1119

@chriswyatt

Description

@chriswyatt

Description

When defining a transformer within a trait, then overriding that value, the transform is not applied.

To Reproduce

See code example below

Model / Factory code
import factory


class FooFactory(factory.StubFactory):
    foo = factory.Transformer(123, transform=hex)

    class Params:
        string = factory.Trait(foo=factory.Transformer(234, transform=str))


if __name__ == '__main__':
    print(FooFactory(foo=345).__dict__)  # {'foo': 345}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions