from unittest.mock import Mock


def mock_group(test_state={}, n=0):
    """Mock a Tradfri group."""
    default_state = {"state": False, "dimmer": 0}

    state = {**default_state, **test_state}

    mock_group = Mock(member_ids=[], observe=Mock(), **state)
    mock_group.name = "tradfri_group_{}".format(n)
    return mock_group