我目前正在http://proctor.andela.com/
进行一些编程测试,我的OOP问题代码在pyCharm和Idle中工作正常/正确但是在测试时#39;提供的编辑器中的代码,我不断收到此错误
/ bin / sh:1:python / nose2 / bin / nose2:not found
因此我无法提交我的代码。
我尝试了以下内容:
进一步的研究表明,这是由用于评估代码的unittest带来的,这是否意味着这是一个服务器问题?
我将很感激此事的任何前进方向,因为测试是时间限制的。
编辑/附加信息 移到另一个实验室并仍然得到相同的错误。这是否指向环境配置错误或服务器端错误?
我的当前设置是:
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
FINAL EDIT&amp; CLOSE (Andela)确认测试平台确实存在严重问题,导致其脱机维护。因此,我可以通过确认这是服务器端问题来结束这个问题。谢谢所有回复/评论的人。
答案 0 :(得分:0)
好吧那么:看看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"}}
这个告诉你,你有某些事要证明/测试..
答案 1 :(得分:0)
没有隐藏的测试。 unittest应该导入类,它不会。 尝试复制测试并放置导入类,然后运行unittest,最有可能的代码将在另一个环境中返回。 这有点不合时宜
答案 2 :(得分:0)
所有测试都返回错误/bin/sh: 1: python/nose2/bin/nose2: not found.
我想这与那些家伙有关。我猜所有代码都没有相同的错误