def test_fit_char_vertical_char_right(self): result = xword.fit_char_vertical(3, 4, 'i') result = result or not isinstance(result, bool) self.assertFalse( result, 'cannot fit a character there, there is already a character' 'to the right of it')
def test_fit_char_vertical_works(self): self.assertTrue(xword.fit_char_vertical(3, 9, 'o'), "should be able to put a character there")
def test_fit_char_vertical_char_left(self): result = xword.fit_char_vertical(3, 6, 'i') result = result or not isinstance(result, bool) self.assertFalse( result, 'cannot fit a character there, there is a char to the left of it')
def test_fit_char_vertical_space_taken(self): result = xword.fit_char_vertical(1, 5, 's') result = result or not isinstance(result, bool) self.assertFalse(result, 'there is already a character in that location')
def test_fit_char_vertical_char_already_there(self): self.assertTrue(xword.fit_char_vertical(1, 5, 'e'), 'this character is already in that location')
assert isinstance(result, str), \ '''char_above should return an str, but returned {0}''' \ .format(type(result)) # Type check crossword.char_below result = crossword.char_below(0, 0) assert isinstance(result, str), \ '''char_below should return an str, but returned {0}''' \ .format(type(result)) # Type check crossword.fit_char_horizontal result = crossword.fit_char_horizontal(0, 0, "s") assert isinstance(result, bool), \ '''fit_char_horizontal should return an bool, but returned {0}''' \ .format(type(result)) # Type check crossword.fit_char_vertical result = crossword.fit_char_vertical(0, 0, "t") assert isinstance(result, bool), \ '''fit_char_vertical should return an bool, but returned {0}''' \ .format(type(result)) # Type check crossword.put_word(word, row, col, direction) result = crossword.put_word("p", 0, 0, "V") assert isinstance(result, type(None)), \ '''put_word should return a NoneType, but returned {0}''' \ .format(type(result)) print("If you see this (and no error messages above it), \ then you have passed the type checker")