def test_row_init():
    """You can initialize a Row, and it stores the attributes"""

    row1 = Row("Joe", "Camel", "WA")

    assert row1.fname == "Joe"
    assert row1.lname == "Camel"
    assert row1.state == "WA"
示例#2
0
def test_row_init():
    """
    test that a new row has the proper attributes initialized
    """
    row1 = Row("Joe", "Camel", "WA")

    assert row1.fname == "Joe"
    assert row1.lname == "Camel"
    assert row1.state == "WA"
def test_paged_rows_state_odd():
    report = example_report()
    # add one more:
    report.add_row(Row("Joe", "Camel", "WA"))

    rows = report.get_paged_rows("state", 2)

    assert len(rows) == 1
    assert rows[0].lname == "Camel"
def test_add_row():
    report = Report(4)

    report.add_row(Row("Fred", "Roberts", "MO"))

    # this is testing using and internal
    # implementation detail, which ou want to be careful of
    # but it will catch an error in the add_row, even when
    # the other methods are not yet written
    assert report.size() == 1
def test_number_of_pages_odd():
    """
    check that the number of pages is correct

    when there is an odd number
    """
    report = example_report()
    report.add_row(Row("Joe", "Camel", "WA"))

    assert report.get_number_of_pages() == 3
def populate_report(report):
    """
    utility function to populate a Report with some data

    :param report: the report object to populate

    The Report will be populated in place
    """
    report.add_row(Row("Natasha", "Smith", "WA"))
    report.add_row(Row("Devin", "Lei", "WA"))
    report.add_row(Row("Bob", "Li", "CA"))
    report.add_row(Row("Tracy", "Jones", "OR"))
    report.add_row(Row("Johnny", "Jakes", "WA"))
    report.add_row(Row("Derek", "Wright", "WA"))
    report.add_row(Row("Jordan", "Cooper", "WA"))
    report.add_row(Row("Mike", "Wong", "WA"))
示例#7
0
def test_row_id_unique():
    """ two Rows should have unique IDs """
    row1 = Row("Joe", "Camel", "WA")
    row2 = Row("Bob", "Camel", "WA")

    assert row1.id != row2.id