import pytest

class Dut(object):
    'fake a device under test'

    _allowed = ('a', 'b', 'c')

    def __init__(self, mode=None):
        self._mode = mode

    def get_mode(self):
        return self._mode

    def set_mode(self, val):
        self._mode = val

    def check_mode(self):
        assert self._mode in self._allowed

# fixtures
@pytest.fixture
def dut(request):
    return Dut('c')


@pytest.yield_fixture(params=('a', 'b', 'c'))
def mode(request, dut):
    orig_mode = dut.get_mode()
    dut.set_mode(request.param)
    yield dut
    dut.set_mode(orig_mode)


@pytest.yield_fixture(params=[1, 2, 3])
def inputs(request):
    yield request.param


def test_modes(mode):
    assert mode.check_mode()


def test_inputs(inputs):
    assert inputs < 2


class TestBoth(object):
    def test_m(self, mode, inputs):
        assert mode.check_mode()
        assert inputs < 2

import pytest

class Dut(object):
    'fake a device under test'

    _allowed = ('a', 'b', 'c')

    def __init__(self, mode=None):
        self._mode = mode

    def get_mode(self):
        return self._mode

    def set_mode(self, val):
        self._mode = val

    def check_mode(self):
        assert self._mode in self._allowed

# fixtures
@pytest.fixture
def dut(request):
    return Dut('c')


@pytest.yield_fixture(params=('a', 'b', 'c'))
def mode(request, dut):
    orig_mode = dut.get_mode()
    dut.set_mode(request.param)
    yield dut
    dut.set_mode(orig_mode)


@pytest.yield_fixture(params=['dog', 'cat', 'mouse'])
def inputs(request):
    yield request.param


def test_modes(mode):
    assert mode.check_mode()


def test_inputs(inputs):
    assert inputs < 2


class TestBoth(object):
    def test_m(self, mode, inputs):
        assert mode.check_mode()
        assert inputs < 2

Tweak some example fixture ids
Tweak some example fixture ids

  import pytest
  
  class Dut(object):
      'fake a device under test'
  
      _allowed = ('a', 'b', 'c')
  
      def __init__(self, mode=None):
          self._mode = mode
  
      def get_mode(self):
          return self._mode
  
      def set_mode(self, val):
          self._mode = val
  
      def check_mode(self):
          assert self._mode in self._allowed
  
  # fixtures
  @pytest.fixture
  def dut(request):
      return Dut('c')
  
  
  @pytest.yield_fixture(params=('a', 'b', 'c'))
  def mode(request, dut):
      orig_mode = dut.get_mode()
      dut.set_mode(request.param)
      yield dut
      dut.set_mode(orig_mode)
  
  
- @pytest.yield_fixture(params=[1, 2, 3])
+ @pytest.yield_fixture(params=['dog', 'cat', 'mouse'])
  def inputs(request):
      yield request.param
  
  
  def test_modes(mode):
      assert mode.check_mode()
  
  
  def test_inputs(inputs):
      assert inputs < 2
  
  
  class TestBoth(object):
      def test_m(self, mode, inputs):
          assert mode.check_mode()
          assert inputs < 2
  
Tweak some example fixture ids
## Code Before:
import pytest

class Dut(object):
    'fake a device under test'

    _allowed = ('a', 'b', 'c')

    def __init__(self, mode=None):
        self._mode = mode

    def get_mode(self):
        return self._mode

    def set_mode(self, val):
        self._mode = val

    def check_mode(self):
        assert self._mode in self._allowed

# fixtures
@pytest.fixture
def dut(request):
    return Dut('c')


@pytest.yield_fixture(params=('a', 'b', 'c'))
def mode(request, dut):
    orig_mode = dut.get_mode()
    dut.set_mode(request.param)
    yield dut
    dut.set_mode(orig_mode)


@pytest.yield_fixture(params=[1, 2, 3])
def inputs(request):
    yield request.param


def test_modes(mode):
    assert mode.check_mode()


def test_inputs(inputs):
    assert inputs < 2


class TestBoth(object):
    def test_m(self, mode, inputs):
        assert mode.check_mode()
        assert inputs < 2

## Instruction:
Tweak some example fixture ids
## Code After:
import pytest

class Dut(object):
    'fake a device under test'

    _allowed = ('a', 'b', 'c')

    def __init__(self, mode=None):
        self._mode = mode

    def get_mode(self):
        return self._mode

    def set_mode(self, val):
        self._mode = val

    def check_mode(self):
        assert self._mode in self._allowed

# fixtures
@pytest.fixture
def dut(request):
    return Dut('c')


@pytest.yield_fixture(params=('a', 'b', 'c'))
def mode(request, dut):
    orig_mode = dut.get_mode()
    dut.set_mode(request.param)
    yield dut
    dut.set_mode(orig_mode)


@pytest.yield_fixture(params=['dog', 'cat', 'mouse'])
def inputs(request):
    yield request.param


def test_modes(mode):
    assert mode.check_mode()


def test_inputs(inputs):
    assert inputs < 2


class TestBoth(object):
    def test_m(self, mode, inputs):
        assert mode.check_mode()
        assert inputs < 2
