-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_main.py
More file actions
33 lines (27 loc) · 1.29 KB
/
test_main.py
File metadata and controls
33 lines (27 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import operator
import unittest
import os
from faker import Faker
class TestMain(unittest.TestCase):
def test_num(self):
# env python3 3.9.2
a_num = 0x12345678901234567890123456789012345678901234567890123456789012345678901234567890
b_num = 0x987654431234567890123456789012345678901234567890123456789012345678901234567890
self.assertGreater(a_num, b_num)
print(operator.gt(str(a_num), str(b_num))) # False
# == python2 cmp(str(a_num), str(b_num)) >> eq <- 0 gt <- 1 lt <- -1
self.assertLess(id(a_num), id(b_num))
# self.assertTrue(operator.gt(str(a_num), str(b_num)))
# self.assertTrue()
def test_faker(self):
faker = Faker("zh_CN")
print('姓名:', faker.name()) # 随机输出中文姓名
print('联系方式:', faker.phone_number()) # 随机输出电话号码
print('地址:', faker.address()) # 随机输出地址
print('公司:', faker.bs()) # 随机输出公司
print('工作:', faker.job()) # 随机输出工作
print('邮箱:', faker.company_email()) # 随机输出邮箱
print('身份证:', faker.ssn(min_age=18, max_age=100)) # 随机输出身份证号码
print('文本:', faker.text()) # 随机文本
if __name__ == '__main__':
unittest.main()