Example #1
0
def main(filename=None):
    # here we create the seater object
    seater = Seater(1000)

    # and we read the file line by line, feeding each line to the Seater
    with open(filename, 'r') as f:
        for line in f:
            seater.seat(line.strip())

    print('number of occupied seats', seater.number_occupied())
    return
Example #2
0
def main(filename=None):
    # here we create the seater object
    seater = Seater(1000)
    
    # and we read the file line by line, feeding each line to the Seater
    with open(filename, 'r') as f:
        for line in f:
            seater.seat(line.strip())
            
    print 'number of occupied seats', seater.number_occupied()
    return
Example #3
0
def test_toogle2():
    # test if my function toogle is correct in occupying seats
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    seater.seat("empty 0,0 through 4,4")
    seater.seat("toggle 0,0 through 4,4")
    assert seater.number_occupied() == 25
Example #4
0
def test_occupy():
    # test if my function occupy is correct
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    seater.seat("empty 0,0 through 4,4")
    seater.seat("occupy 0,0 through 2,2")
    assert seater.number_occupied() == 9
Example #5
0
def test_toogle2():
    # test if my function toogle is correct in occupying seats
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    seater.seat("empty 0,0 through 4,4")
    seater.seat("toggle 0,0 through 4,4")
    assert seater.number_occupied()== 25
Example #6
0
def test_occupy():
    # test if my function occupy is correct
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    seater.seat("empty 0,0 through 4,4")
    seater.seat("occupy 0,0 through 2,2")
    assert seater.number_occupied()== 9
Example #7
0
def test_number_occupied():
    # test if my function number_occupied is correct
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    assert seater.number_occupied() == 25
Example #8
0
def test_number_occupied():
    # test if my function number_occupied is correct
    seater = Seater(size=5)
    seater.seat("occupy 0,0 through 4,4")
    assert seater.number_occupied()== 25