Skip to content

# testing

## `xsdata.utils.testing`

### `Factory`

Bases: `ABC`

Source code in `xsdata/utils/testing.py`

     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104

    class Factory(abc.ABC):
        counter = 0
        model: type

        @classmethod
        @abc.abstractmethod
        def create(cls, **kwargs: Any) -> Any:
            """Abstract method create."""

        @classmethod
        def reset(cls):
            cls.counter = 65

        @classmethod
        def next_letter(cls) -> str:
            cls.counter += 1
            return chr(cls.counter)

        @classmethod
        def list(cls, number: int, **kwargs: Any) -> list:
            return [cls.create(**kwargs) for _ in range(number)]

#### `create(**kwargs)` `abstractmethod` `classmethod`

Abstract method create.

Source code in `xsdata/utils/testing.py`

    88
    89
    90
    91

    @classmethod
    @abc.abstractmethod
    def create(cls, **kwargs: Any) -> Any:
        """Abstract method create."""