代码拉取完成,页面将自动刷新
# _*_ coding:utf-8 _*_
import pytest
import count
# import GUI
def test_passing():
assert (1, 2, 3) == (1, 2, 3) # 默认样例,肯定会通过的
# def test_file_name(): # 测试
# GUI.create_window()
# filename = GUI.click_button_open()#好像无法返回值,这个无法测试
# expected_filename = r"C:\Users\feemo\Documents\PycharmProjects\Python_word_count\欧路简版.txt"
# assert filename == expected_filename # 默认样例,肯定会通过的
def test_hangshu(): # 针对行数的特定文件的测试
mode = '-h'
file_name = '欧路简版.txt' # 行数一共6行
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result == 12, "测试失败"
# print("测试通过")
def test_character(): # 针对字符数的特定文件的测试
mode = '-c'
file_name = '欧路简版.txt' # 字符数为320
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result == 476, "测试失败"
# print("测试通过")
def test_word(): # 针对字符数的特定文件的测试
mode = '-w'
file_name = '欧路简版.txt' # 单词数为46
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result == 122
def test_blanklines(): # 针对字符数的特定文件的测试
mode = '-b'
file_name = '欧路简版.txt' # 空行为2
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result == 2
def test_codelines(): # 针对字符数的特定文件的测试
mode = '-code'
file_name = '欧路简版.txt' # 代码行为7
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result ==7
def test_commentlines(): # 针对字符数的特定文件的测试
mode = '-#'
file_name = '欧路简版.txt' # 注释行为7
helper = count.CountHelper(mode, file_name)
result = helper.choose()
assert result ==1
# if __name__ == '__main__':
# mode, file_name = count.file()
# test_addition(mode,file_name)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。