代码拉取完成,页面将自动刷新
同步操作将从 首都经济贸易大学-高强/e0501-builtins 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import pytest
import e01_str_quiz as q
def test_001():
# 不要学这里的代码, 这不是标准答案
assert q.A001 == b"a string with \x27single\x27 quotes".decode()
def test_002():
# 不要学这里的代码, 这不是标准答案
assert q.A002 == b"a string with \x22double\x22 quotes".decode()
def test_003():
# 不要学这里的代码, 这不是标准答案
assert (
q.A003
== b"a string with \x27single\x27 and \x22double\x22 quotes".decode()
)
def test_004():
assert q.Q004 == q.A004
def test_005():
# 不要学这里的代码, 这不是标准答案
assert q.A005 == b"t\x09t\x09t".decode()
def test_006():
# 不要学这里的代码, 这不是标准答案
assert q.A006 == b"n\x0An\x0An".decode()
@pytest.mark.parametrize(
"code, exchange, res",
[
["600519", "SH", "600519.SH|600519sh|SH600519"],
["300750", "sz", "300750.SZ|300750sz|SZ300750"],
["835185", "Bj", "835185.BJ|835185bj|BJ835185"],
],
)
def test_007(code, exchange, res):
assert q.f007(code=code, exchange=exchange) == res
@pytest.mark.parametrize(
"number, output",
[
[15, "00001111"],
[42, "00101010"],
[240, "11110000"],
],
)
def test_008(number, output, capsys):
q.f008(number)
out, err = capsys.readouterr()
assert out == output + "\n"
@pytest.mark.parametrize(
"args, joined",
[
[["/bin", "/usr/bin"], "/bin:/usr/bin"],
[
["/bin", "/usr/bin", "/usr/local/bin"],
"/bin:/usr/bin:/usr/local/bin",
],
[["/home"], "/home"],
],
)
def test_009(args, joined):
assert q.f009(*args) == joined
@pytest.mark.parametrize(
"split, joined",
[
[["/bin", "/usr/bin"], "/bin:/usr/bin"],
[
["/bin", "/sbin", "/usr/local/bin"],
"/bin:/sbin:/usr/local/bin",
],
[["/home"], "/home"],
],
)
def test_010(split, joined):
assert q.f010(joined) == split
@pytest.mark.parametrize(
"filename, name, ext",
[
["README.txt", "README", "txt"],
["script.py", "script", "py"],
["backup.tar.gz", "backup.tar", "gz"],
],
)
def test_011(filename, name, ext):
res = q.f011(filename)
assert res == (name, ext)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。