Пример #1
0
def test_empty_list_projection():
    """
    Test projection operation when using a list that is empty.
    """

    try:
        project(COMPLETELY_EMPTY1, ["Surname"])
    except IndexError:
        assert True
Пример #2
0
def test_wrong_column_projection():
    """
    Test the projection operation when faced with a column head that did not exist, i.e. an
    Unknown Attribute.
    """
    try:
        project(EMPTY_LIST, ["Does Not Exist"])
    except AttributeError:
        assert True
Пример #3
0
def test_wrong_column_projection():
    """
    Test the projection operation when faced with a column head that did not exist, i.e. an
    Unknown Attribute.
    """
    try:
        project(EMPTY_LIST, ["Does Not Exist"])
    except AttributeError:
        assert True
Пример #4
0
def test_empty_list_projection():
    """
    Test projection operation when using a list that is empty.
    """

    try:
        project(COMPLETELY_EMPTY1, ["Surname"])
    except IndexError:
        assert True
Пример #5
0
def test_project():
    """
    Test the projection operation.
    """

    result = [["FirstName", "Surname"], ["Hoban", "Washburne"],
              ["Zoe", "Washburne"], ["Malcolm", "Reynolds"], ["Jayne", "Cobb"],
              ["Inara", "Serra"]]

    assert is_equal(result, project(STUDENTS, ["FirstName", "Surname"]))
Пример #6
0
def test_project():
    """
    Test the projection operation.
    """

    result = [
        ["FirstName", "Surname"],
        ["Hoban", "Washburne"],
        ["Zoe", "Washburne"],
        ["Malcolm", "Reynolds"],
        ["Jayne", "Cobb"],
        ["Inara", "Serra"],
    ]

    assert is_equal(result, project(STUDENTS, ["FirstName", "Surname"]))