@pytest.mark.parametrize(
    "user_authenticated,tutorial_dismissed,show_tutorial",
    [(False, False, False),
     (True,  False, True),
     (True,  True,  False)])
def test_model_show_sidebar_tutorial(
        fake_user, user_authenticated, tutorial_dismissed, show_tutorial):
    """It should return or not return "show_sidebar_tutorial" correctly.

    It should return "show_sidebar_tutorial": True only if a user
    is authorized _and_ that user has not dismissed
    the tutorial. Otherwise, preferences should contain no
    "show_sidebar_tutorial" value at all.

    """
    fake_user.sidebar_tutorial_dismissed = tutorial_dismissed
    if user_authenticated:
        authenticated_user = fake_user
    else:
        authenticated_user = None
    request = mock.Mock(
        authenticated_user=authenticated_user,
        )

    preferences = session.model(request)['preferences']

    if show_tutorial:
        assert preferences['show_sidebar_tutorial'] is True
    else:
        assert 'show_sidebar_tutorial' not in preferences
dataset/ETHPy150Open hypothesis/h/h/test/session_test.py/test_model_show_sidebar_tutorial/original