Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions exercises/isogram/isogram_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,39 @@ class TestIsogram(unittest.TestCase):
def test_empty_string(self):
self.assertTrue(is_isogram(""))

@unittest.skip("remove this annotation to run this test")
def test_isogram_with_only_lower_case_characters(self):
self.assertTrue(is_isogram("isogram"))

@unittest.skip("remove this annotation to run this test")
def test_word_with_one_duplicated_character(self):
self.assertFalse(is_isogram("eleven"))

@unittest.skip("remove this annotation to run this test")
def test_longest_reported_english_isogram(self):
self.assertTrue(is_isogram("subdermatoglyphic"))

@unittest.skip("remove this annotation to run this test")
def test_word_with_duplicated_character_in_mixed_case(self):
self.assertFalse(is_isogram("Alphabet"))

@unittest.skip("remove this annotation to run this test")
def test_hypothetical_isogrammic_word_with_hyphen(self):
self.assertTrue(is_isogram("thumbscrew-japingly"))

@unittest.skip("remove this annotation to run this test")
def test_isogram_with_duplicated_non_letter_character(self):
self.assertTrue(is_isogram("Hjelmqvist-Gryb-Zock-Pfund-Wax"))

@unittest.skip("remove this annotation to run this test")
def test_made_up_name_that_is_an_isogram(self):
self.assertTrue(is_isogram("Emily Jung Schwartzkopf"))

@unittest.skip("remove this annotation to run this test")
def test_duplicated_character_in_the_middle(self):
self.assertFalse(is_isogram("accentor"))

@unittest.skip("remove this annotation to run this test")
def test_isogram_with_duplicated_letter_and_nonletter_character(self):
self.assertFalse(is_isogram("Aleph Bot Chap"))

Expand Down
9 changes: 9 additions & 0 deletions test/check-exercises.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@ def check_assignment(name, test_file):
try:
test_file_out = os.path.join(workdir, os.path.basename(test_file))
shutil.copyfile(test_file, test_file_out)
unskip_tests(test_file_out)
shutil.copyfile(os.path.join(os.path.dirname(test_file), 'example.py'),
os.path.join(workdir, '{}.py'.format(example_name)))
return subprocess.call([python_executable_name(), test_file_out])
finally:
shutil.rmtree(workdir)


def unskip_tests(testfile):
with open(testfile) as f:
txt = f.read()
txt = txt.replace('@unittest.skip', '#@unittest.skip')
with open(testfile, 'w') as f:
f.write(txt)


def modname_heuristic(test_file):
with open(test_file) as f:
tree = ast.parse(f.read(), filename=test_file)
Expand Down