-
-
Save nathanwilson/9e2618a7835b3c6c6474 to your computer and use it in GitHub Desktop.
RotorTest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nathan (master *) Enigma $ nosetests | |
EE | |
====================================================================== | |
ERROR: tests.Rotor_Test.TestRotor.test_check_letter_substitution_matches_expected_value | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/Library/Python/2.7/site-packages/nose/case.py", line 197, in runTest | |
self.test(*self.arg) | |
File "/Users/nathan/Code/Enigma/tests/Rotor_Test.py", line 18, in test_check_letter_substitution_matches_expected_value | |
assert self.rotor.get_letter_substitution('a') == 'b' | |
AttributeError: TestRotor instance has no attribute 'rotor' | |
====================================================================== | |
ERROR: tests.Rotor_Test.TestRotor.test_check_rotor_is_created | |
---------------------------------------------------------------------- | |
Traceback (most recent call last): | |
File "/Library/Python/2.7/site-packages/nose/case.py", line 197, in runTest | |
self.test(*self.arg) | |
File "/Users/nathan/Code/Enigma/tests/Rotor_Test.py", line 14, in test_check_rotor_is_created | |
assert self.rotor is not None | |
AttributeError: TestRotor instance has no attribute 'rotor' | |
---------------------------------------------------------------------- | |
Ran 2 tests in 0.006s | |
FAILED (errors=2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nose.tools import * | |
from Enigma import Rotor | |
class TestRotor: | |
def setup_func(self): | |
self.rotor = Rotor() | |
def teardown_func(self): | |
pass | |
@with_setup(setup_func, teardown_func) | |
def test_check_rotor_is_created(self): | |
assert self.rotor is not None | |
@with_setup(setup_func, teardown_func) | |
def test_check_letter_substitution_matches_expected_value(self): | |
assert self.rotor.get_letter_substitution('a') == 'b' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment