本文整理汇总了Python中names.get_last_name函数的典型用法代码示例。如果您正苦于以下问题:Python get_last_name函数的具体用法?Python get_last_name怎么用?Python get_last_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_last_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_personal_shopper_assignment
def test_personal_shopper_assignment(self):
#Create some personal shoppers
personal_shopper1 = PersonalShopper.objects.create(
first_name=names.get_first_name(gender="female"),
last_name=names.get_last_name(),
)
personal_shopper2 = PersonalShopper.objects.create(
first_name=names.get_first_name(gender="female"),
last_name=names.get_last_name(),
)
personal_shopper1.save()
personal_shopper2.save()
personal_shopper1.regions.add(self.region)
personal_shopper2.regions.add(self.region)
#Create some users without recent orders and assign them to personal shopper 1
for _ in xrange(5):
member = Member.objects.create(
first_name=names.get_first_name(gender='male'),
last_name=names.get_last_name(),
phone_number=random.randint(1, 9999999999),
region=random_region(),
personal_shopper=personal_shopper1,
)
member.save()
#Check if a new member would be assigned to personal shopper 2
self.assertEqual(assign_personal_shopper(self.region), personal_shopper2)
示例2: test_competitor_creation
def test_competitor_creation(sh):
prefix = Preferences.TestingPrefix
sh = SetupHelper.SetupHelper()
sh.setManualDbCursor(DatabaseConnection.DatabaseConnection().getDatabaseCursor())
if random() < 0.5:
print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='male'), "U18M", prefix)
else:
print sh.createNewCompetitor(names.get_last_name(), names.get_first_name(gender='female'), "U18F", prefix)
示例3: test_correct_files
def test_correct_files(self):
with patch_file(test_files):
self.assertEqual(names.get_first_name(gender='male'), "Male")
self.assertEqual(names.get_first_name(gender='female'), "Female")
self.assertEqual(names.get_last_name(), "Last")
# Test with cached responses
self.assertEqual(names.get_first_name(gender='male',
cached=True), "Male")
self.assertEqual(names.get_first_name(gender='female',
cached=True), "Female")
self.assertEqual(names.get_last_name(True), "Last")
示例4: mk_author_db
def mk_author_db(db_path="author.db", pops=500):
""" Makes and Author DB and populates it
:param db_path: the path where the DB is created
:pops: The amount of entries that will be generated
"""
conn, cur = get_conn_cur(db_path)
cur.execute("""CREATE TABLE author (
aid INTEGER ,
firstname TEXT,
lastname TEXT,
city TEXT,
bid INTEGER)""")
#Get This working....
author_list = []
author_list.extend ( [(0, 'Mathias', 'Jensen', 'Hadsten', 3),
(1, 'Mathias', 'Jensen', 'Hadsten', 4),
(2, 'Alexander', 'Danger', 'Skanderborg', 0),
(3, 'Alexander', 'Danger', 'Skanderborg', 4),
(6, 'Alexander', 'Danger', 'Hadsten', 4),
(4, 'Arash', 'Kjær', 'Kobenhavn', 1),
(5, 'Michael', 'Med K', None, 2)])
for x in range(ENTRIES_AUTHOR):
author_list.append((x+6, names.get_first_name(), names.get_last_name(),
random.choice(CITIES), x+6))
cur.executemany("INSERT INTO author VALUES(?, ?, ?, ?, ?)", author_list)
conn.commit()
conn.close()
示例5: crea_sede
def crea_sede(presidente=None, estensione=LOCALE, genitore=None,
locazione=None):
ESTENSIONE_DICT = dict(ESTENSIONE)
locazione = locazione or crea_locazione()
s = Sede(
nome="Com. " + ESTENSIONE_DICT[estensione] + " " + names.get_last_name(),
tipo=Sede.COMITATO,
estensione=estensione,
genitore=genitore,
telefono='+3902020202',
email='[email protected]',
codice_fiscale='01234567891',
partita_iva='01234567891',
locazione=locazione
)
s.save()
if presidente is not None:
d = Delega(
inizio="1980-12-10",
persona=presidente,
tipo=PRESIDENTE,
oggetto=s
)
d.save()
return s
示例6: gen_admin
def gen_admin(self):
b, admin = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Administrator, email=self.random_email(),
first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
admin = admin.get_typed_user()
admin.hospital = self.random_hospital().first()
admin.is_pending = False
admin.save()
示例7: gen_nurse
def gen_nurse(self):
b, nurse = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Nurse, email=self.random_email(),
first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
nurse = nurse.get_typed_user()
nurse.hospital = self.random_hospital().first()
nurse.is_pending = False
nurse.save()
示例8: __init__
def __init__(self):
id_length = random.randint(config.min_id_length, config.max_id_length)
self.id = utils.random_string(id_length)
sex = random.choice(['male', 'female'])
if sex == 'male':
self.sex = 'M'
else:
self.sex = 'F'
self.first_name = names.get_first_name(sex)
self.last_name = names.get_last_name()
self.middle_name = ''
if config.gen_mid_name:
if random.random() < config.gen_mid_name_chance:
if random.randint(0, 1):
self.middle_name = names.get_first_name(sex)
else:
self.middle_name = names.get_first_name(sex)[0]
start = datetime.datetime(1900, 1, 1)
end = datetime.datetime.now()
self.birth_date = utils.random_date_between(start, end)
self.aliases = []
if config.gen_alias:
for i in xrange(config.gen_alias_max):
if random.random() < config.gen_alias_chance:
self.aliases.append(self.generate_alias())
self.studies = self.generate_studies(self.birth_date)
示例9: __init__
def __init__(self):
# Gender
self.gender = self.gender()
self.genderTitle = self.genderTitle()
self.genderPronoun = self.genderPronoun()
self.genderPossessive = self.genderPossessive()
# Basics
self.firstName = names.get_first_name(self.gender)
self.lastName = names.get_last_name()
self.personality = self.personality(self.gender)
# Appearance
self.eyecolor = data.pick('appearance.eyes.color')
self.skincolor = data.pick('appearance.skin.color')
self.hairtype = data.pick('appearance.hair.type')
self.haircolor = data.pick('appearance.hair.color')
self.hairstyle = data.pick('appearance.hair.style.'+self.gender)
self.height = data.pick('appearance.height')
self.build = data.pick('appearance.build.'+self.gender)
# Other
self.minimumAge = 18
self.previousService = self.previousService()
self.birthPlace = data.pick('places.birthplaces')
示例10: inserir_randomico
def inserir_randomico(self, repeat=10):
''' Inserir registros com valores randomicos names '''
lista = []
for _ in range(repeat):
date = datetime.datetime.now().isoformat(" ")
fname = names.get_first_name()
lname = names.get_last_name()
name = fname + ' ' + lname
email = fname[0].lower() + '.' + lname.lower() + '@email.com'
c = gen_city()
city = c[0]
uf = c[1]
lista.append((name, gen_age(), gen_cpf(),
email, gen_phone(),
city, uf, date))
try:
self.db.cursor.executemany("""
INSERT INTO clientes (nome, idade, cpf, email, fone, cidade, uf, criado_em)
VALUES (?,?,?,?,?,?,?,?)
""", lista)
self.db.commit_db()
print("Inserindo %s registros na tabela..." % repeat)
print("Registros criados com sucesso.")
except sqlite3.IntegrityError:
print("Aviso: O email deve ser único.")
return False
示例11: test_empty_file
def test_empty_file(self):
empty_files = {
'first:male': full_path('test/empty.txt'),
'first:female': full_path('test/empty.txt'),
'last': full_path('test/empty.txt'),
}
with patch_file(empty_files):
self.assertEqual(names.get_first_name(gender='male'), "")
self.assertEqual(names.get_first_name(gender='female'), "")
self.assertEqual(names.get_last_name(), "")
# Test with cached responses
self.assertEqual(names.get_first_name(gender='male',
cached=True), "")
self.assertEqual(names.get_first_name(gender='female',
cached=True), "")
self.assertEqual(names.get_last_name(True), "")
示例12: create_some_fixtures
def create_some_fixtures(sender, instance, created, **kwargs):
import names
import random
if not created:
return
for x in range(5):
first = names.get_first_name()
last = names.get_last_name()
full_name = u'{} {}'.format(first, last)
email = u'{}@example.com'.format(first.lower().strip())
Contact.objects.create(user=instance,
full_name=full_name,
email=email)
adj = random.choice(['crazy', 'black', 'fancy',
'sneaky', 'giant', 'spicy'])
thing = random.choice(['shoe', 'cat', 'lamp',
'car', 'parrot', 'burrito'])
title = u'{} wants a {} {}'.format(first, adj, thing)
description = 'This is not a very good description is it?'
Deal.objects.create(user=instance,
title=title,
description=description,
value=random.random() * 100)
示例13: populate_candidates
def populate_candidates():
"""
Sends requests to connect to populate our sandbox Connector with 5 random
candidates.
"""
for i in range(5):
last_name = names.get_last_name()
candidate = {
'first_name': names.get_first_name(),
'last_name': last_name,
'email': '{}{}@example.com'.format(last_name,
choice(range(100)))
}
candidate_data = {
# A random job_id will be fine as we are in a sandbox environment
'candidate': candidate, 'applications': [{'job_id': '101'}]
}
# We can choose to either include a callback header with our
# request, or to poll until the application is complete. Here
# we use the callback functionality.
headers = {
'content-type': 'application/rolepoint.v2+json',
'x-rolepoint-callback-url': url_for(
'application_processed_callback',
app_id=len(CREATED_CANDIDATES), _external=True
)
}
requests.post(
CONNECT_URL + '/v1/{}/candidate'.format(CONFIG['connector_id']),
json=candidate_data, auth=AUTH, headers=headers
)
candidate['status'] = 'In Progress'
CREATED_CANDIDATES.append(candidate)
示例14: insert_random_seller
def insert_random_seller(self, repeat=qsellers):
''' Inserir registros com valores randomicos '''
seller_list = []
for _ in range(repeat):
d = gen_timestamp(2014, 2015) + '+00'
fname = names.get_first_name()
lname = names.get_last_name()
email = fname[0].lower() + '.' + lname.lower() + '@example.com'
birthday = gen_timestamp() + '+00'
active = rstr.rstr('01', 1)
internal = rstr.rstr('01', 1)
commissioned = rstr.rstr('01', 1)
commission = 0.01
seller_list.append(
(gen_cpf(), fname, lname, email, gen_phone(), birthday, active, internal, commissioned, commission, d, d))
try:
self.db.cursor.executemany("""
INSERT INTO vendas_seller (cpf, firstname, lastname, email, phone, birthday, active, internal, commissioned, commission, created, modified)
VALUES (?,?,?,?,?,?,?,?,?,?,?,?)
""", seller_list)
self.db.commit_db()
print("Inserindo %s registros na tabela vendas_seller." % repeat)
print("Registros criados com sucesso.")
except sqlite3.IntegrityError:
print("Aviso: O email deve ser único.")
return False
示例15: gen_doctor
def gen_doctor(self):
b, doc = User.create_user(username=self.random_alphanum(5, 20), password="password", usertype=UserType.Doctor, email=self.random_email(),
first_name=names.get_first_name(), last_name=names.get_last_name(), print_stdout=False)
doc = doc.get_typed_user()
doc.hospitals = self.random_hospital(random.randint(1, 10))
doc.is_pending = False
doc.save()