Beispiel #1
0
def test_Building():
    """
    calcute count errors
    :return: int
    """
    errors = 0
    try:
        import classroom
        import building
    except:
        errors += 1
    try:
        classroom_016 = classroom.Classroom('016', 80, ['PC', 'projector',\
                                                        'mic'])
        classroom_007 = classroom.Classroom('007', 12, ['TV'])
        classroom_008 = classroom.Classroom('008', 25, ['PC', 'projector'])
        classrooms = [classroom_016, classroom_007, classroom_008]
        building = building.AcademicBuilding('Kozelnytska st. 2a', classrooms)
    except:
        errors += 1
    try:
        print(building.adress)
    except:
        errors += 1
    try:
        for room in building.classrooms:
            print(room)
    except:
        errors += 1
    try:
        print(building.total_equipment())
    except:
        errors += 1
    try:
        print(building)
    except:
        errors += 1
    return errors
Beispiel #2
0
import classroom
import building

if __name__ == '__main__':
    classroom_016 = classroom.Classroom('016', 80, ['PC', 'projector', 'mic'])
    classroom_007 = classroom.Classroom('007', 12, ['TV'])
    classroom_008 = classroom.Classroom('008', 25, ['PC', 'projector'])
    classrooms = [classroom_016, classroom_007, classroom_008]
    my_building = building.AcademicBuilding('Kozelnytska st. 2a', classrooms)
    assert my_building.address == 'Kozelnytska st. 2a'
    total_equipment = [('PC', 2), ('projector', 2), ('mic', 1), ('TV', 1)]
    assert total_equipment == my_building.total_equipment()
Beispiel #3
0
import building
import classroom_input

if __name__ == '__main__':
    address = input('Address: ')
    number_of_rooms = input('Print number of rooms: ')
    classrooms = []
    for i in range(int(number_of_rooms)):
        classroom = classroom_input.read_classroom()
        print(classroom)
        classrooms.append(classroom)
    main_building = building.AcademicBuilding(address, classrooms)
    print(main_building.total_equipment())
    print(main_building)
Beispiel #4
0
import building
import classroom

if __name__ == '__main__':
    classroom1 = classroom.Classroom('012', 12, ['TV', 'printer', 'scanner'])
    classroom2 = classroom.Classroom('008', 80, ['TV', 'PC', 'printer'])
    classroom3 = classroom.Classroom('028', 28, ['projector'])
    building1 = building.AcademicBuilding('Kozelnytska 2a', \
                [classroom1, classroom2, classroom3])

    # a
    print(building1.address)
    for room in building1.classrooms:
        print(room)
    # b
    print(building1.total_equipment())
    # c
    print(building1)