Skip to content

Infer Django model return from factory-boy factories #3214

@stumpylog

Description

@stumpylog

Describe the Bug

We use factory-boy, specifically the DjangoModelFactory as a standard way to create models over bare .create calls.

pyrefly doesn't infer the return is a Django model:

    {
      "line": 393,
      "column": 37,
      "stop_line": 393,
      "stop_column": 53,
      "path": "src/paperless_mail/tests/test_api.py",
      "code": -2,
      "name": "missing-attribute",
      "description": "Object of class `DocumentTypeFactory` has no attribute `pk`",
      "concise_description": "Object of class `DocumentTypeFactory` has no attribute `pk`",
      "severity": "error"
    },

It would be nice if this could be directly inferred by pyrefly.

Sandbox Link

No response

(Only applicable for extension issues) IDE Information

No response

Metadata

Metadata

Assignees

Labels

No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions