コード例 #1
0
def test_only_column_count_returns_correct_number():
    """ Checks that the column count is correct """
    # Given
    model = TreeModel()

    # Then
    assert model.columnCount(QModelIndex()) == len(list(TreeModelCols))
コード例 #2
0
def test_setdata_returns_false_on_invalid_column():
    """ When setting data, false is returned for invalid column """
    # Given
    model = TreeModel()
    project = ResearchProject("")
    plan = ResearchPlan()
    project.plans.append(plan)

    model.set_project(project)
    plan_index = model.index(0, model.columnCount(None) + 1, model.plans_index)

    # When
    retval = model.setData(plan_index, "Foo")

    assert retval is False