import pytest
from model_bakery import baker


@pytest.fixture
def author(db):
    return baker.make('Author', name='<NAME>')

@pytest.fixture
def authors(db):
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')

@pytest.fixture
def book(author):
    return baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1938,
        edition=1,
        authors=[author]
    )

@pytest.fixture
def books(db):
    author1 = baker.make('Author', name='<NAME>')
    author2 = baker.make('Author', name='<NAME>')

    baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1938,
        edition=1,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1947,
        edition=2,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='<NAME>',
        publication_year=1934,
        edition=1,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='<NAME>',
        publication_year=1899,
        edition=1,
        authors=[author2]
    )
    baker.make(
        'Book',
        name='Memórias Póstumas de Brás Cubas',
        publication_year=1880,
        edition=1,
        authors=[author2]
    )

import pytest
from model_bakery import baker


@pytest.fixture
def author(db):
    return baker.make('Author', name='<NAME>')

@pytest.fixture
def authors(db):
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')
    baker.make('Author', name='<NAME>')

@pytest.fixture
def book(author):
    return baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1938,
        edition=1,
        authors=[author]
    )

@pytest.fixture
def books(db):
    author1 = baker.make('Author', name='<NAME>')
    author2 = baker.make('Author', name='<NAME>')

    baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1938,
        edition=1,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='Vidas Secas',
        publication_year=1947,
        edition=2,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='<NAME>',
        publication_year=1934,
        edition=1,
        authors=[author1]
    )
    baker.make(
        'Book',
        name='<NAME>',
        publication_year=1899,
        edition=1,
        authors=[author2]
    )
    baker.make(
        'Book',
        name='Memórias Póstumas de Brás Cubas',
        publication_year=1880,
        edition=1,
        authors=[author2]
    )
