python笔记-013-简单的单元测试
来源:互联网 发布:淘宝小黄鸭 编辑:程序博客网 时间:2024/06/01 07:37
def get_city_country(city, country): format_string = city.title() + ' ' + country.title() return format_stringdef get_city_country_population(city, country, population): format_string = city.title() + ', ' \ + country.title() + ' - ' \ + 'population ' + str(population) return format_string
from city_functions import get_city_countryfrom city_functions import get_city_country_populationimport unittestclass test_cities(unittest.TestCase): def test_city_country(self): format_string = get_city_country('beijing', 'china') self.assertEqual(format_string, 'Beijing China') def test_city_country_population(self): format_string = get_city_country_population('santiago', 'chile', 5000000) self.assertEqual(format_string, 'Santiago, Chile - population 5000000')unittest.main()''' assertEqual(a, b) 核实a == b assertNotEqual(a, b) 核实a != b assertTrue(x) 核实x为True assertFalse(x) 核实x为False assertIn(item, list) 核实 item在 list中 assertNotIn(item, list) 核实 item不在 list中'''
阅读全文
0 0
- python笔记-013-简单的单元测试
- [PYTHON]一个简单的单元测试框架
- python单元测试简单案例
- 【Python学习笔记】单元测试
- python学习笔记 单元测试
- python简单的笔记
- 简单的单元测试
- 简单的junit单元测试
- ios 简单的单元测试
- python的单元测试unittest
- Python的单元测试
- 《单元测试的艺术》笔记
- 单元测试JUnit的简单例子
- 最简单的android单元测试
- 简单的Java单元测试框架
- 单元测试框架的简单实现
- 简单的日志和单元测试
- JUnit 单元测试的简单使用
- innobackupex单表增量备份与恢复
- ffmpeg解码调用思路
- Golang 如何将多个对象添加到切片里的不同方式,空切片的不同定义方式
- 简单工厂模式
- 模COMSOL Multiphysics v5.3 Win64 & Linux64 & MacOSX64 1DVD
- python笔记-013-简单的单元测试
- innobackupex单库增量备份
- sqlite3.exe常用命令
- 对于支付宝支付
- 导航栏问题解决
- 单例模式的八种写法比较
- F1V3.0-图形-OpenLayers2体系分析
- Android工程师学习路径
- 记录