Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

重新检查单元测试代码,删除冗余测试句 #26

Open
peter-way opened this issue Aug 25, 2018 · 1 comment
Open

重新检查单元测试代码,删除冗余测试句 #26

peter-way opened this issue Aug 25, 2018 · 1 comment

Comments

@peter-way
Copy link

比如

    data_true = 18
    data_flase = 30
    assert example == data_true
    assert example != data_flase

这里的 example 只有一种情况,只需要判断预期值便可,不需要再判断一次非预期值。

而且,这代码罗嗦又臃肿,没有精简!!!

@sunpudding
Copy link
Owner

对于此部分和其他的代码,已做修改。

def test_find_start_flags():
    """测试第三次握手时的循环数i"""
    client = ['192.168.43.158', 64343]
    server = ['183.232.24.222', 80]
    metas = ['192.168.43.158', '183.232.24.222', 64343, 80, 0, 0, 16, None, 'C->S',
             '183.232.24.222', '192.168.43.158', 80, 64343, 1, 1, 18, None, 'S->C',
             '192.168.43.158', '183.232.24.222', 64343, 80, 2, 1, 16, None, 'C->S', ]
    example = TcpData(metas, client, server).find_start_flags(metas)
    assert example == 18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants