[英]Online OOP Test: python/nose2/bin/nose2: not found
我目前正在http://proctor.andela.com/
进行一些编程测试,我在OC问题的代码在pyCharm和Idle中工作正常/正确,但在提供的编辑器中“测试”代码时,我不断得到这个错误
/ bin / sh:1:python / nose2 / bin / nose2:找不到
因此我无法提交我的代码。
我尝试过以下方法:
进一步的研究表明,这是由用于评估代码的单元测试引起的,这是否意味着这是一个服务器问题?
我将在这件事上表示感谢,因为测试是时间限制的。
编辑/附加信息移动到另一个实验室并仍然得到相同的错误。 这不是指向环境配置错误或服务器端错误吗?
我目前的设置是:
Linux Mint 17.3 64位。 按建议通过Google Chrome进行测试。 使用Firefox时出现相同的错误。
我的代码,供参考:
class BankAccount(object):
def deposit(self):
pass
def withdraw(self):
pass
class SavingsAccount(BankAccount):
def __init__(self):
self.balance = 500
def deposit(self, amount):
if amount < 0:
return 'Invalid deposit amount'
else:
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
return 'Invalid withdraw amount'
elif amount > self.balance:
return 'Cannot withdraw beyond the current account balance'
elif (self.balance - amount < 500):
return 'Cannot withdraw beyond the minimum account balance'
else:
self.balance -= amount
return self.balance
class CurrentAccount(BankAccount):
def __init__(self):
self.balance = 0
def deposit(self, amount):
if amount < 0:
return 'Invalid deposit amount'
else:
self.balance += amount
return self.balance
def withdraw(self, amount):
if amount < 0:
return 'Invalid withdrawal amount'
elif amount > self.balance:
return 'Cannot withdraw beyond the current account balance'
else:
self.balance -= amount
return self.balance
最终编辑和关闭 (Andela)确认测试平台确实存在严重问题,导致其脱机进行维护。 因此,我可以通过确认这是服务器端问题来结束这个问题。 谢谢所有回复/评论的人。
好吧那么:看看test.spy代码非常仔细地看它,因为它有很多与解决方案有关..我发现这个错误:
HERE IS AN ERROR/BUG IN YOUR CODE
Results:
{"finished": true, "success": [{"fullName":
"test_current_account_can_withdraw_valid_cash_amounts", "passedSpecNumber": 1}, {"fullName": "test_current_account_is_instance_of_bank_account", "passedSpecNumber": 2}, {"fullName": "test_savings_account_can_withdraw_valid_amounts_successfully", "passedSpecNumber": 3},
{"fullName": "test_savings_account_is_instance_of_bank_account", "passedSpecNumber": 4}], "passed": false, "started": true, "failures": [{"failedSpecNumber": 1, "fullName": "test_current_account_can_deposit_valid_amounts", "failedExpectations": [{"message": "Failure in line 20, in test_current_account_can_deposit_valid_amounts\n self.assertEquals(balance, 1500)\nAssertionError: None != 1500\n"}]}, {"failedSpecNumber": 2, "fullName": "test_current_account_cannot_withdraw_more_than_current_balance", "failedExpectations": [{"message": "Failure in line 24, in test_current_account_cannot_withdraw_more_than_current_balance\n self.assertEquals(message, 'Cannot withdraw beyond the current account balance', msg='No overdrafts')\nAssertionError: No overdrafts\n"}]},
{"failedSpecNumber": 3, "fullName": "test_savings_account_can_deposit_valid_amounts", "failedExpectations": [{"message": "Failure in line 44, in test_savings_account_can_deposit_valid_amounts\n
self.assertEquals(balance, (1500 + init_balance)
, msg='Balance does not match deposit')\nAssertionError: Balance does not match deposit\n"}]}, {"failedSpecNumber": 4, "fullName": "test_savings_account_cannot_withdraw_more_than_current_balance", "failedExpectations": [{"message": "Failure in line 48, in test_savings_account_cannot_withdraw_more_than_current_balance\n self.assertEquals(message, 'Cannot withdraw beyond the current account balance', msg='No overdrafts')\nAssertionError: No overdrafts\n"}]}], "specs": {"count": 8, "pendingCount": 0, "time": "0.016354"}}
这个告诉你,你有某些事要证明/测试..
没有隐藏的测试。 unittest应该导入类,它不会。 尝试复制测试并放置导入类,然后运行unittest,最有可能的代码将在另一个环境中返回。 这是令人遗憾的不合时宜的
所有测试都返回错误/bin/sh: 1: python/nose2/bin/nose2: not found.
我想这与那些家伙有关。 我猜所有代码都不能有相同的错误
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.