我写的代码在互联网上无处不在。但在Codechef上,它显示了NZEC错误。我不明白为什么。我尝试了很多测试用例,并且我在计算机上或任何地方都可以获得预期的输出。请帮忙。 以下是我的源代码:
import pytest
class remote_conn:
def __init__(self, u, p):
self.u = u
self.p = p
# print "{}-{}".format(u, p)
def close(self):
# print "closed"
pass
def do_this(self, a):
# print "do_this {}".format(a)
return True
def do_that(self, a):
# print "do that {}".format(a)
return True
credentials = [("uname1", "pwd1"), ("uname2", "pwd3"), ("uname3", "pwd3")]
@pytest.fixture(scope="class", params=credentials)
def conn(request):
_credentials = request.param
con = remote_conn(*_credentials)
def fin():
con.close()
request.addfinalizer(fin)
return con
class Test_123:
"""Test Class"""
@pytest.mark.parametrize("a", [1, 2])
def test_1(self, a, conn):
assert conn.do_this(a)
@pytest.mark.parametrize("a", [1, 2])
def test_2(self, a, conn):
assert conn.do_that(a)