标签:sdi 测试 src png test data info collect lse
慢慢的,这块知识也补好吧。
系统的学习框架,具体的细节,可以边百度边实现。
test_three.py
‘‘‘Test the Task data type.‘‘‘ from collections import namedtuple Task = namedtuple(‘Task‘, [‘summary‘, ‘owner‘, ‘done‘, ‘id‘]) Task.__new__.__defaults__=(None, None, False, None) def test_defaults(): t1 = Task() t2 = Task(None, None, False, None) assert t1 == t2 def test_member_access(): t = Task(‘buy milk‘, ‘brian‘) assert t.summary == ‘buy milk‘ assert t.owner == ‘brian‘ assert (t.done, t.id) == (False, None)
‘‘‘Test the Task data type‘‘‘ from collections import namedtuple Task = namedtuple(‘Task‘, [‘summary‘, ‘owner‘, ‘done‘, ‘id‘]) Task.__new__.__defaults__=(None, None, False, None) def test_asdict(): t_task = Task(‘do something‘, ‘okken‘, True, 21) t_dict = t_task._asdict() expected = {‘summary‘: ‘do something‘, ‘owner‘: ‘okken‘, ‘done‘: True, ‘id‘: 21} assert t_dict == expected def test_replace(): t_before = Task(‘finish book‘, ‘brian‘, False) t_after = t_before._replace(id = 10, done = True) t_expected = Task(‘finish book‘, ‘brian‘, True, 10) assert t_after == t_expected
标签:sdi 测试 src png test data info collect lse
原文地址:https://www.cnblogs.com/aguncn/p/9363123.html