예제 #1
0
def adminInsertBus(Bus):
    BT = BusTable()
    return BT.insert_bus(Bus)
예제 #2
0
def assert_not_none(argv: list):
    for i in argv:
        assert i is not None


if __name__ == '__main__':

    bus_list = []
    des_list = ["北京", "上海", "广州", "深圳", "东莞", "华工大学城校区", "华工五山校区"]
    for i in range(10):
        j_idx = random.randrange(0, int(len(des_list) / 2))
        i_idx = random.randrange(int(len(des_list) / 2), len(des_list))
        h_1 = random.randrange(0, 24)
        h_2 = random.randrange(h_1, 24)
        min_1 = random.randrange(0, 60)
        min_2 = random.randrange(0, 60)
        _t1 = str(h_1) + ":" + str(min_1)
        _t2 = str(h_2) + ":" + str(min_2)
        _bus = Bus(BusId=str(random.randint(10000, 20000)),
                   Destination=des_list[i_idx],
                   Price=random.randint(0, 100),
                   Departure=des_list[j_idx],
                   dTime=_t1,
                   aTime=_t2)
        try:
            # bus_table.delete_bus('{}')
            bus_table.insert_bus(_bus)
        except OSError:
            print("insert error")