Skip to content

Commit 379e3e0

Browse files
committed
新增python类的测试
1 parent ceea09b commit 379e3e0

1 file changed

Lines changed: 53 additions & 0 deletions

File tree

test/test_class.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env python
2+
# encoding: utf-8
3+
4+
"""
5+
@author: zhanghe
6+
@software: PyCharm
7+
@file: test_class.py
8+
@time: 16-1-9 下午3:54
9+
"""
10+
11+
12+
class BaseResume(object):
13+
"""
14+
简历基本信息
15+
USAGE:
16+
user_info = {
17+
'name': 'Tom',
18+
'age': 20
19+
}
20+
base_resume = BaseResume(name='Tom', age=20) # 方式一
21+
base_resume = BaseResume(**user_info) # 方式二
22+
"""
23+
# 定义基本属性
24+
link = '' # 简历详情链接
25+
name = '' # 姓名
26+
uid = '' # 用户ID
27+
email = '' # 用户邮箱
28+
phone = '' # 用户电话
29+
apply_id = '' # 应聘ID
30+
sex = '' # 性别
31+
age = '' # 年龄
32+
education = '' # 学历(教育背景)
33+
resume_id = '' # 简历ID
34+
major_name = '' # 专业名称
35+
p_id = '' # 职位ID
36+
work_years = '' # 工作年限
37+
living_city = '' # 现居住地
38+
39+
# 定义构造方法
40+
def __init__(self, **kwargs):
41+
for key, value in kwargs.iteritems():
42+
self.__setattr__(key, value)
43+
44+
45+
if __name__ == '__main__':
46+
user_info = {
47+
'name': 'Tom',
48+
'age': 20
49+
}
50+
# base_resume = BaseResume(name='Tom', age=20) # 方式一
51+
base_resume = BaseResume(**user_info) # 方式二
52+
print base_resume.name
53+
print base_resume.age

0 commit comments

Comments
 (0)