mirror of
https://github.com/donnemartin/interactive-coding-challenges
synced 2026-01-04 00:18:02 +00:00
@@ -1,25 +1,25 @@
|
||||
from nose.tools import assert_equal, assert_raises
|
||||
import unittest
|
||||
|
||||
|
||||
class TestSolution(object):
|
||||
class TestSolution(unittest.TestCase):
|
||||
|
||||
def test_count_sentence_fit(self):
|
||||
solution = Solution()
|
||||
assert_raises(TypeError, solution.count_sentence_fit,
|
||||
self.assertRaises(TypeError, solution.count_sentence_fit,
|
||||
None, None, None)
|
||||
assert_raises(ValueError, solution.count_sentence_fit,
|
||||
self.assertRaises(ValueError, solution.count_sentence_fit,
|
||||
'abc', rows=-1, cols=-1)
|
||||
sentence = ["hello", "world"]
|
||||
expected = 1
|
||||
assert_equal(solution.count_sentence_fit(sentence, rows=2, cols=8),
|
||||
self.assertEqual(solution.count_sentence_fit(sentence, rows=2, cols=8),
|
||||
expected)
|
||||
sentence = ["a", "bcd", "e"]
|
||||
expected = 2
|
||||
assert_equal(solution.count_sentence_fit(sentence, rows=3, cols=6),
|
||||
self.assertEqual(solution.count_sentence_fit(sentence, rows=3, cols=6),
|
||||
expected)
|
||||
sentence = ["I", "had", "apple", "pie"]
|
||||
expected = 1
|
||||
assert_equal(solution.count_sentence_fit(sentence, rows=4, cols=5),
|
||||
self.assertEqual(solution.count_sentence_fit(sentence, rows=4, cols=5),
|
||||
expected)
|
||||
print('Success: test_count_sentence_fit')
|
||||
|
||||
@@ -30,4 +30,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user