Exemple #1
0
def get_random_student(id):
    fake = faker.Faker()
    name = names.get_full_name()
    first_last = name.lower().split(' ')
    email = first_last[0][0] + '.' + first_last[1] + '@innopolis.ru'
    address = fake.address().replace('\n', ' ')
    return student(id, name, email, address)
Exemple #2
0
def get_random_student(id):
    fake = faker.Faker()
    name = names.get_full_name()
    first_last = name.lower().split(' ')
    email = first_last[0][0] + '.' + first_last[1] + '@innopolis.ru'
    address = fake.address().replace('\n', ' ')
    return student(id, name, email, address)
Exemple #3
0
def db_load_test():
    print 'load test is started..\n'
    db = Table(type=student, from_dump=True)
    # print student(db.get('581200', 1)).attrs
    print 'test get student with id = 581200..\n'
    print(student(to_parse=db.get('581200', 1)))
    print 'test neighbours of Matthew Cervantes..\n'
    nbrs = db.neighbours('name', 'Matthew Cervantes', 10)
    for nbr in nbrs:
        print nbr.attrs
    print 'test update Matthew Cervantes to Kamil..\n'
    print(student(to_parse=db.get('581200', 1)).attrs)
    db.update('581200', 1, {'name': 'Kamil'})
    print(student(to_parse=db.get('581200', 1)).attrs)
    print 'test remove Kamil by his id..\n'
    db.remove('581200', 1)
    if db.get('581200', 1) == None:
        print('Kamil is removed!')
Exemple #4
0
def db_load_test():
    print 'load test is started..\n'
    db = Table(type=student, from_dump=True)
    # print student(db.get('581200', 1)).attrs
    print 'test get student with id = 581200..\n'
    print(student(to_parse=db.get('581200', 1)))
    print 'test neighbours of Matthew Cervantes..\n'
    nbrs = db.neighbours('name', 'Matthew Cervantes', 10)
    for nbr in nbrs:
        print nbr.attrs
    print 'test update Matthew Cervantes to Kamil..\n'
    print(student(to_parse=db.get('581200', 1)).attrs)
    db.update('581200', 1, {'name': 'Kamil'})
    print(student(to_parse=db.get('581200', 1)).attrs)
    print 'test remove Kamil by his id..\n'
    db.remove('581200', 1)
    if db.get('581200', 1) == None:
        print('Kamil is removed!')
Exemple #5
0
def get_shuffled_dataset():
    filename = 'rand_to_put.txt'
    f = open(filename, 'r')
    line = f.readline()
    studs = []
    while line:
        toks = line.split('$')
        s = student(int(toks[0]), toks[1], toks[3].strip(), toks[2])
        studs.append(s)
        line = f.readline()
    f.close()
    return studs
Exemple #6
0
def get_shuffled_dataset():
    filename = 'rand_to_put.txt'
    f = open(filename, 'r')
    line = f.readline()
    studs = []
    while line:
        toks = line.split('$')
        s = student(int(toks[0]), toks[1], toks[3].strip(), toks[2])
        studs.append(s)
        line = f.readline()
    f.close()
    return studs