2015-11-22 19:18:13 +01:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
|
|
from pangram import is_pangram
|
|
|
|
|
|
|
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
# test cases adapted from `x-common//canonical-data.json` @ version: 1.0.0
|
2015-11-22 19:18:13 +01:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
class PangramTests(unittest.TestCase):
|
|
|
|
|
def test_sentence_empty(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(is_pangram(''), False)
|
2015-11-22 19:18:13 +01:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
def test_pangram_with_only_lower_case(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('the quick brown fox jumps over the lazy dog'),
|
|
|
|
|
True)
|
2015-11-22 19:18:13 +01:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
def test_missing_character_x(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
2017-03-28 02:54:41 +02:00
|
|
|
is_pangram('a quick movement of the enemy will '
|
2017-10-14 08:27:39 +00:00
|
|
|
'jeopardize five gunboats'),
|
|
|
|
|
False)
|
2015-11-22 19:18:13 +01:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
def test_another_missing_character_x(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('the quick brown fish jumps over the lazy dog'),
|
|
|
|
|
False)
|
2016-07-20 13:03:07 -07:00
|
|
|
|
|
|
|
|
def test_pangram_with_underscores(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('the_quick_brown_fox_jumps_over_the_lazy_dog'),
|
|
|
|
|
True)
|
2016-07-20 13:03:07 -07:00
|
|
|
|
|
|
|
|
def test_pangram_with_numbers(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('the 1 quick brown fox jumps over the 2 lazy dogs'),
|
|
|
|
|
True)
|
2016-07-20 13:03:07 -07:00
|
|
|
|
|
|
|
|
def test_missing_letters_replaced_by_numbers(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog'),
|
|
|
|
|
False)
|
2016-07-20 13:03:07 -07:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
def test_pangram_with_mixedcase_and_punctuation(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('"Five quacking Zephyrs jolt my wax bed."'),
|
|
|
|
|
True)
|
2015-11-22 19:18:13 +01:00
|
|
|
|
2017-03-28 02:54:41 +02:00
|
|
|
def test_upper_and_lower_case_versions_of_the_same_character(self):
|
2017-10-14 08:27:39 +00:00
|
|
|
self.assertIs(
|
|
|
|
|
is_pangram('the quick brown fox jumped over the lazy FOX'),
|
|
|
|
|
False)
|
2015-11-22 19:18:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
unittest.main()
|