From 3054267c2e136381e36a018e1255935986b5c2e8 Mon Sep 17 00:00:00 2001 From: David Kinzer Date: Wed, 25 Mar 2015 10:38:27 -0400 Subject: [PATCH 1/3] Skip all but the first test. This change adds a skip to all but the first test for every problem set in order to avoid overwhelming the users with a bunch of failed test. This approach is the same as how the Ruby tests have been implemented, which encourages a pseudo TDD style to solving the exercises. --- accumulate/accumulate_test.py | 5 +++++ allergies/allergies_test.py | 6 ++++++ anagram/anagram_test.py | 8 ++++++++ atbash-cipher/atbash_cipher_test.py | 9 +++++++++ beer-song/beer_song_test.py | 5 +++++ binary/binary_test.py | 8 ++++++++ bob/bob_test.py | 19 +++++++++++++++++++ crypto-square/crypto_square_test.py | 4 ++++ .../difference_of_squares_test.py | 5 +++++ etl/etl_test.py | 3 +++ gigasecond/gigasecond_test.py | 5 +++++ grade-school/grade_school_test.py | 6 ++++++ grains/grains_test.py | 6 ++++++ hamming/hamming_test.py | 6 ++++++ hexadecimal/hexadecimal_test.py | 9 +++++++++ .../kindergarten_garden_test.py | 3 +++ .../largest_series_product_test.py | 7 +++++++ leap/leap_test.py | 4 ++++ luhn/luhn_test.py | 9 +++++++++ matrix/matrix_test.py | 5 +++++ meetup/meetup_test.py | 10 ++++++++++ minesweeper/minesweeper_test.py | 11 +++++++++++ nth-prime/nth_prime_test.py | 3 +++ nucleotide-count/nucleotide_count_test.py | 6 ++++++ ocr-numbers/ocr_test.py | 8 ++++++++ octal/octal_test.py | 9 +++++++++ .../palindrome_products_test.py | 4 ++++ pascals-triangle/pascals_triangle_test.py | 6 ++++++ phone-number/phone_number_test.py | 7 +++++++ point-mutations/point_mutations_test.py | 7 +++++++ prime-factors/prime_factors_test.py | 10 ++++++++++ proverb/proverb_test.py | 5 +++++ .../pythagorean_triplet_test.py | 9 +++++++++ queen-attack/queen_attack_test.py | 13 +++++++++++++ raindrops/raindrops_test.py | 15 +++++++++++++++ rna-transcription/rna_transcription_test.py | 4 ++++ robot-name/robot_name_test.py | 3 +++ saddle-points/saddle_points_test.py | 4 ++++ scrabble-score/scrabble_score_test.py | 6 ++++++ secret-handshake/handshake_test.py | 12 ++++++++++++ series/series_test.py | 6 ++++++ sieve/sieve_test.py | 2 ++ simple-cipher/simple_cipher_test.py | 10 ++++++++++ space-age/space_age_test.py | 8 ++++++++ strain/strain_test.py | 7 +++++++ sublist/sublist_test.py | 14 ++++++++++++++ sum-of-multiples/sum_of_multiples_test.py | 7 +++++++ triangle/triangle_test.py | 13 +++++++++++++ trinary/trinary_test.py | 6 ++++++ twelve-days/twelve_days_test.py | 13 +++++++++++++ word-count/word_count_test.py | 7 +++++++ wordy/wordy_test.py | 17 +++++++++++++++++ 52 files changed, 394 insertions(+) diff --git a/accumulate/accumulate_test.py b/accumulate/accumulate_test.py index 87f3a1eff8..102272320f 100644 --- a/accumulate/accumulate_test.py +++ b/accumulate/accumulate_test.py @@ -7,26 +7,31 @@ class AccumulateTest(unittest.TestCase): def test_empty_sequence(self): self.assertEqual([], accumulate([], lambda x: x/2)) + @unittest.skip("") def test_pow(self): self.assertEqual([1, 4, 9, 16, 25], accumulate([1, 2, 3, 4, 5], lambda x: x*x)) + @unittest.skip("") def test_divmod(self): inp = [10, 17, 23] out = [(1, 3), (2, 3), (3, 2)] self.assertEqual(out, accumulate(inp, lambda x: divmod(x, 7))) + @unittest.skip("") def test_composition(self): inp = [10, 17, 23] fn1 = lambda x: divmod(x, 7) fn2 = lambda x: 7*x[0]+x[1] self.assertEqual(inp, accumulate(accumulate(inp, fn1), fn2)) + @unittest.skip("") def test_capitalize(self): inp = ['hello', 'world'] out = ['HELLO', 'WORLD'] self.assertEqual(out, accumulate(inp, str.upper)) + @unittest.skip("") def test_recursive(self): inp = list('abc') out = [['a1', 'a2', 'a3'], ['b1', 'b2', 'b3'], ['c1', 'c2', 'c3']] diff --git a/allergies/allergies_test.py b/allergies/allergies_test.py index 946dc5edc7..65e842e001 100644 --- a/allergies/allergies_test.py +++ b/allergies/allergies_test.py @@ -11,27 +11,33 @@ def test_no_allergies_means_not_allergic(self): self.assertFalse(allergies.is_allergic_to('cats')) self.assertFalse(allergies.is_allergic_to('strawberries')) + @unittest.skip("") def test_is_allergic_to_eggs(self): self.assertTrue(Allergies(1).is_allergic_to('eggs')) + @unittest.skip("") def test_has_the_right_allergies(self): allergies = Allergies(5) self.assertTrue(allergies.is_allergic_to('eggs')) self.assertTrue(allergies.is_allergic_to('shellfish')) self.assertFalse(allergies.is_allergic_to('strawberries')) + @unittest.skip("") def test_no_allergies_at_all(self): self.assertEqual([], Allergies(0).list) + @unittest.skip("") def test_allergic_to_just_peanuts(self): self.assertEqual(['peanuts'], Allergies(2).list) + @unittest.skip("") def test_allergic_to_everything(self): self.assertEqual( ('eggs peanuts shellfish strawberries tomatoes ' 'chocolate pollen cats').split(), Allergies(255).list) + @unittest.skip("") def test_ignore_non_allergen_score_parts(self): self.assertEqual(['eggs'], Allergies(257).list) diff --git a/anagram/anagram_test.py b/anagram/anagram_test.py index 41802423d9..7026e7b754 100644 --- a/anagram/anagram_test.py +++ b/anagram/anagram_test.py @@ -10,36 +10,42 @@ def test_no_matches(self): detect_anagrams('diaper', 'hello world zombies pants'.split()) ) + @unittest.skip("") def test_detect_simple_anagram(self): self.assertEqual( ['tan'], detect_anagrams('ant', 'tan stand at'.split()) ) + @unittest.skip("") def test_detect_multiple_anagrams(self): self.assertEqual( ['stream', 'maters'], detect_anagrams('master', 'stream pigeon maters'.split()) ) + @unittest.skip("") def test_does_not_confuse_different_duplicates(self): self.assertEqual( [], detect_anagrams('galea', ['eagle']) ) + @unittest.skip("") def test_eliminate_anagram_subsets(self): self.assertEqual( [], detect_anagrams('good', 'dog goody'.split()) ) + @unittest.skip("") def test_detect_anagram(self): self.assertEqual( ['inlets'], detect_anagrams('listen', 'enlists google inlets banana'.split()) ) + @unittest.skip("") def test_multiple_anagrams(self): self.assertEqual( 'gallery regally largely'.split(), @@ -49,6 +55,7 @@ def test_multiple_anagrams(self): ) ) + @unittest.skip("") def test_anagrams_are_case_insensitive(self): self.assertEqual( ['Carthorse'], @@ -56,6 +63,7 @@ def test_anagrams_are_case_insensitive(self): 'cashregister Carthorse radishes'.split()) ) + @unittest.skip("") def test_same_word_isnt_anagram(self): self.assertEqual( [], diff --git a/atbash-cipher/atbash_cipher_test.py b/atbash-cipher/atbash_cipher_test.py index 1ae89199e9..3dab0192f7 100644 --- a/atbash-cipher/atbash_cipher_test.py +++ b/atbash-cipher/atbash_cipher_test.py @@ -8,34 +8,43 @@ class AtbashCipherTest(unittest.TestCase): def test_encode_no(self): self.assertEqual("ml", encode("no")) + @unittest.skip("") def test_encode_yes(self): self.assertEqual("bvh", encode("yes")) + @unittest.skip("") def test_encode_OMG(self): self.assertEqual("lnt", encode("OMG")) + @unittest.skip("") def test_encode_O_M_G(self): self.assertEqual("lnt", encode("O M G")) + @unittest.skip("") def test_encode_long_word(self): self.assertEqual("nrmwy oldrm tob", encode("mindblowingly")) + @unittest.skip("") def test_encode_numbers(self): self.assertEqual("gvhgr mt123 gvhgr mt", encode("Testing, 1 2 3, testing.")) + @unittest.skip("") def test_encode_sentence(self): self.assertEqual("gifgs rhurx grlm", encode("Truth is fiction.")) + @unittest.skip("") def test_encode_all_things(self): plaintext = "The quick brown fox jumps over the lazy dog." ciphertext = "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" self.assertEqual(ciphertext, encode(plaintext)) + @unittest.skip("") def test_decode_word(self): self.assertEqual("exercism", decode("vcvix rhn")) + @unittest.skip("") def test_decode_sentence(self): self.assertEqual("anobstacleisoftenasteppingstone", decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v")) diff --git a/beer-song/beer_song_test.py b/beer-song/beer_song_test.py index 810d025d92..f838d8411f 100644 --- a/beer-song/beer_song_test.py +++ b/beer-song/beer_song_test.py @@ -11,6 +11,7 @@ def test_a_verse(self): "Take one down and pass it around, 7 bottles of beer on the wall.\n" ) + @unittest.skip("") def test_verse_1(self): self.assertEqual( verse(1), @@ -18,6 +19,7 @@ def test_verse_1(self): "Take it down and pass it around, no more bottles of beer on the wall.\n" ) + @unittest.skip("") def test_verse_2(self): self.assertEqual( verse(2), @@ -25,6 +27,7 @@ def test_verse_2(self): "Take one down and pass it around, 1 bottle of beer on the wall.\n" ) + @unittest.skip("") def test_verse_0(self): self.assertEqual( verse(0), @@ -32,6 +35,7 @@ def test_verse_0(self): "Go to the store and buy some more, 99 bottles of beer on the wall.\n" ) + @unittest.skip("") def test_songing_several_verses(self): self.assertEqual( song(8, 6), @@ -46,6 +50,7 @@ def test_songing_several_verses(self): "\n" ) + @unittest.skip("") def test_song_all_the_rest_of_the_verses(self): self.assertEqual( song(3), diff --git a/binary/binary_test.py b/binary/binary_test.py index f572dda065..519b9ce55b 100644 --- a/binary/binary_test.py +++ b/binary/binary_test.py @@ -13,27 +13,35 @@ class BinaryTests(unittest.TestCase): def test_binary_1_is_decimal_1(self): self.assertEqual(1, parse_binary("1")) + @unittest.skip("") def test_binary_10_is_decimal_2(self): self.assertEqual(2, parse_binary("10")) + @unittest.skip("") def test_binary_11_is_decimal_3(self): self.assertEqual(3, parse_binary("11")) + @unittest.skip("") def test_binary_100_is_decimal_4(self): self.assertEqual(4, parse_binary("100")) + @unittest.skip("") def test_binary_1001_is_decimal_9(self): self.assertEqual(9, parse_binary("1001")) + @unittest.skip("") def test_binary_11010_is_decimal_26(self): self.assertEqual(26, parse_binary("11010")) + @unittest.skip("") def test_binary_10001101000_is_decimal_1128(self): self.assertEqual(1128, parse_binary("10001101000")) + @unittest.skip("") def test_invalid_binary_raises_error(self): self.assertRaises(ValueError, parse_binary, "carrot") + @unittest.skip("") def test_invalid_binary_raises_error_2(self): self.assertRaises(ValueError, parse_binary, "102011") diff --git a/bob/bob_test.py b/bob/bob_test.py index 689d053c01..9f456ab491 100644 --- a/bob/bob_test.py +++ b/bob/bob_test.py @@ -14,101 +14,120 @@ def test_stating_something(self): bob.hey('Tom-ay-to, tom-aaaah-to.') ) + @unittest.skip("") def test_shouting(self): self.assertEqual( 'Whoa, chill out!', bob.hey('WATCH OUT!') ) + @unittest.skip("") def test_asking_a_question(self): self.assertEqual( 'Sure.', bob.hey('Does this cryogenic chamber make me look fat?') ) + @unittest.skip("") def test_asking_a_numeric_question(self): self.assertEqual( 'Sure.', bob.hey('You are, what, like 15?') ) + @unittest.skip("") def test_talking_forcefully(self): self.assertEqual( 'Whatever.', bob.hey("Let's go make out behind the gym!") ) + @unittest.skip("") def test_using_acronyms_in_regular_speech(self): self.assertEqual( 'Whatever.', bob.hey("It's OK if you don't want to go to the DMV.") ) + @unittest.skip("") def test_forceful_questions(self): self.assertEqual( 'Whoa, chill out!', bob.hey('WHAT THE HELL WERE YOU THINKING?') ) + @unittest.skip("") def test_shouting_numbers(self): self.assertEqual( 'Whoa, chill out!', bob.hey('1, 2, 3 GO!') ) + @unittest.skip("") def test_only_numbers(self): self.assertEqual( 'Whatever.', bob.hey('1, 2, 3') ) + @unittest.skip("") def test_question_with_only_numbers(self): self.assertEqual( 'Sure.', bob.hey('4?') ) + @unittest.skip("") def test_shouting_with_special_characters(self): self.assertEqual( 'Whoa, chill out!', bob.hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!') ) + @unittest.skip("") def test_shouting_with_umlauts(self): self.assertEqual( 'Whoa, chill out!', bob.hey('ÜMLÄÜTS!') ) + @unittest.skip("") def test_calmly_speaking_with_umlauts(self): self.assertEqual( 'Whatever.', bob.hey('ÜMLäÜTS!') ) + @unittest.skip("") def test_shouting_with_no_exclamation_mark(self): self.assertEqual( 'Whoa, chill out!', bob.hey('I HATE YOU') ) + @unittest.skip("") def test_statement_containing_question_mark(self): self.assertEqual( 'Whatever.', bob.hey('Ending with ? means a question.') ) + @unittest.skip("") def test_prattling_on(self): self.assertEqual( 'Sure.', bob.hey("Wait! Hang on. Are you going to be OK?") ) + @unittest.skip("") def test_silence(self): self.assertEqual( 'Fine. Be that way!', bob.hey('') ) + @unittest.skip("") def test_prolonged_silence(self): self.assertEqual( 'Fine. Be that way!', bob.hey(' \t') ) + @unittest.skip("") def test_starts_with_whitespace(self): self.assertEqual( 'Whatever.', bob.hey(' hmmmmmmm...') ) + @unittest.skip("") def test_ends_with_whitespace(self): self.assertEqual( 'Sure.', bob.hey('What if we end with whitespace? ') diff --git a/crypto-square/crypto_square_test.py b/crypto-square/crypto_square_test.py index 0f7bb478e6..cf4f9c1d6a 100644 --- a/crypto-square/crypto_square_test.py +++ b/crypto-square/crypto_square_test.py @@ -8,17 +8,21 @@ class CryptoSquareTest(unittest.TestCase): def test_empty_string(self): self.assertEqual('', encode('')) + @unittest.skip("") def test_perfect_square(self): self.assertEqual('ac bd', encode('ABCD')) + @unittest.skip("") def test_small_imperfect_square(self): self.assertEqual('tis hsy ie sa', encode('This is easy!')) + @unittest.skip("") def test_punctuation_and_numbers(self): msg = "1, 2, 3, Go! Go, for God's sake!" ciph = '1gga 2ook 3fde gos ors' self.assertEqual(ciph, encode(msg)) + @unittest.skip("") def test_long_string(self): msg = ("If man was meant to stay on the ground, god would have given " "us roots.") diff --git a/difference-of-squares/difference_of_squares_test.py b/difference-of-squares/difference_of_squares_test.py index 5e0c5d0f0f..9c93fb1184 100644 --- a/difference-of-squares/difference_of_squares_test.py +++ b/difference-of-squares/difference_of_squares_test.py @@ -8,18 +8,23 @@ class DifferenceOfSquaresTest(unittest.TestCase): def test_square_of_sum_5(self): self.assertEqual(225, square_of_sum(5)) + @unittest.skip("") def test_sum_of_squares_5(self): self.assertEqual(55, sum_of_squares(5)) + @unittest.skip("") def test_difference_5(self): self.assertEqual(170, difference(5)) + @unittest.skip("") def test_square_of_sum_100(self): self.assertEqual(25502500, square_of_sum(100)) + @unittest.skip("") def test_sum_of_squares_100(self): self.assertEqual(338350, sum_of_squares(100)) + @unittest.skip("") def test_difference_100(self): self.assertEqual(25164150, difference(100)) diff --git a/etl/etl_test.py b/etl/etl_test.py index eb9d5e07e3..bdcbc1b0f5 100644 --- a/etl/etl_test.py +++ b/etl/etl_test.py @@ -10,12 +10,14 @@ def test_transform_one_value(self): self.assertEqual(expected, etl.transform(old)) + @unittest.skip("") def test_transform_more_values(self): old = {1: ['WORLD', 'GSCHOOLERS']} expected = {'world': 1, 'gschoolers': 1} self.assertEqual(expected, etl.transform(old)) + @unittest.skip("") def test_more_keys(self): old = {1: ['APPLE', 'ARTICHOKE'], 2: ['BOAT', 'BALLERINA']} expected = { @@ -27,6 +29,7 @@ def test_more_keys(self): self.assertEqual(expected, etl.transform(old)) + @unittest.skip("") def test_full_dataset(self): old = { 1: "AEIOULNRST", diff --git a/gigasecond/gigasecond_test.py b/gigasecond/gigasecond_test.py index cfc9735926..bd68f07a60 100644 --- a/gigasecond/gigasecond_test.py +++ b/gigasecond/gigasecond_test.py @@ -11,30 +11,35 @@ def test_1(self): add_gigasecond(datetime(2011, 4, 25)) ) + @unittest.skip("") def test_2(self): self.assertEqual( datetime(2009, 2, 19, 1, 46, 40), add_gigasecond(datetime(1977, 6, 13)) ) + @unittest.skip("") def test_3(self): self.assertEqual( datetime(1991, 3, 27, 1, 46, 40), add_gigasecond(datetime(1959, 7, 19)) ) + @unittest.skip("") def test_4(self): self.assertEqual( datetime(2046, 10, 2, 23, 46, 40), add_gigasecond(datetime(2015, 1, 24, 22, 0, 0)) ) + @unittest.skip("") def test_5(self): self.assertEqual( datetime(2046, 10, 3, 1, 46, 39), add_gigasecond(datetime(2015, 1, 24, 23, 59, 59)) ) + @unittest.skip("") def test_yourself(self): # customize this to test your birthday and find your gigasecond date: your_birthday = datetime(1970, 1, 1) diff --git a/grade-school/grade_school_test.py b/grade-school/grade_school_test.py index 8e74b1f73f..c84a061dd1 100644 --- a/grade-school/grade_school_test.py +++ b/grade-school/grade_school_test.py @@ -12,30 +12,36 @@ def setUp(self): def test_an_empty_school(self): self.assertEqual({}, self.school.db) + @unittest.skip("") def test_add_student(self): self.school.add("Aimee", 2) self.assertEqual({2: {"Aimee"}}, self.school.db) + @unittest.skip("") def test_add_more_students_in_same_class(self): self.school.add("James", 2) self.school.add("Blair", 2) self.school.add("Paul", 2) self.assertEqual({2: {"James", "Blair", "Paul"}}, self.school.db) + @unittest.skip("") def test_add_students_to_different_grades(self): self.school.add("Chelsea", 3) self.school.add("Logan", 7) self.assertEqual({3: {"Chelsea"}, 7: {"Logan"}}, self.school.db) + @unittest.skip("") def test_get_students_in_a_grade(self): self.school.add("Franklin", 5) self.school.add("Bradley", 5) self.school.add("Jeff", 1) self.assertEqual({"Franklin", "Bradley"}, self.school.grade(5)) + @unittest.skip("") def test_get_students_in_a_non_existant_grade(self): self.assertEqual(set(), self.school.grade(1)) + @unittest.skip("") def test_sort_school(self): students = [ (3, ("Kyle",)), diff --git a/grains/grains_test.py b/grains/grains_test.py index 703dd59894..ee3c070881 100644 --- a/grains/grains_test.py +++ b/grains/grains_test.py @@ -8,26 +8,32 @@ def test_square_1(self): self.assertEqual(1, on_square(1)) self.assertEqual(1, total_after(1)) + @unittest.skip("") def test_square_2(self): self.assertEqual(2, on_square(2)) self.assertEqual(3, total_after(2)) + @unittest.skip("") def test_square_3(self): self.assertEqual(4, on_square(3)) self.assertEqual(7, total_after(3)) + @unittest.skip("") def test_square_4(self): self.assertEqual(8, on_square(4)) self.assertEqual(15, total_after(4)) + @unittest.skip("") def test_square_16(self): self.assertEqual(32768, on_square(16)) self.assertEqual(65535, total_after(16)) + @unittest.skip("") def test_square_32(self): self.assertEqual(2147483648, on_square(32)) self.assertEqual(4294967295, total_after(32)) + @unittest.skip("") def test_square_64(self): self.assertEqual(9223372036854775808, on_square(64)) self.assertEqual(18446744073709551615, total_after(64)) diff --git a/hamming/hamming_test.py b/hamming/hamming_test.py index 1213a55e10..5727facf6f 100644 --- a/hamming/hamming_test.py +++ b/hamming/hamming_test.py @@ -8,21 +8,27 @@ class HammingTest(unittest.TestCase): def test_no_difference_between_identical_strands(self): self.assertEqual(0, hamming.distance('A', 'A')) + @unittest.skip("") def test_complete_hamming_distance_of_for_single_nucleotide_strand(self): self.assertEqual(1, hamming.distance('A', 'G')) + @unittest.skip("") def test_complete_hamming_distance_of_for_small_strand(self): self.assertEqual(2, hamming.distance('AG', 'CT')) + @unittest.skip("") def test_small_hamming_distance(self): self.assertEqual(1, hamming.distance('AT', 'CT')) + @unittest.skip("") def test_small_hamming_distance_in_longer_strand(self): self.assertEqual(1, hamming.distance('GGACG', 'GGTCG')) + @unittest.skip("") def test_large_hamming_distance(self): self.assertEqual(4, hamming.distance('GATACA', 'GCATAA')) + @unittest.skip("") def test_hamming_distance_in_very_long_strand(self): self.assertEqual(9, hamming.distance('GGACGGATTCTG', 'AGGACGGATTCT')) diff --git a/hexadecimal/hexadecimal_test.py b/hexadecimal/hexadecimal_test.py index 1ddbcf8e8c..55a5d07ca2 100644 --- a/hexadecimal/hexadecimal_test.py +++ b/hexadecimal/hexadecimal_test.py @@ -11,30 +11,39 @@ class HexadecimalTest(unittest.TestCase): def test_valid_hexa1(self): self.assertEqual(1, hexa('1')) + @unittest.skip("") def test_valid_hexa2(self): self.assertEqual(12, hexa('c')) + @unittest.skip("") def test_valid_hexa3(self): self.assertEqual(16, hexa('10')) + @unittest.skip("") def test_valid_hexa4(self): self.assertEqual(175, hexa('af')) + @unittest.skip("") def test_valid_hexa5(self): self.assertEqual(256, hexa('100')) + @unittest.skip("") def test_valid_hexa6(self): self.assertEqual(105166, hexa('19ACE')) + @unittest.skip("") def test_valid_hexa7(self): self.assertEqual(0, hexa('000000')) + @unittest.skip("") def test_valid_hexa8(self): self.assertEqual(16776960, hexa('ffff00')) + @unittest.skip("") def test_valid_hexa9(self): self.assertEqual(65520, hexa('00fff0')) + @unittest.skip("") def test_invalid_hexa(self): with self.assertRaises(ValueError): hexa('carrot') diff --git a/kindergarten-garden/kindergarten_garden_test.py b/kindergarten-garden/kindergarten_garden_test.py index a9ce5690d7..dc6d10e819 100644 --- a/kindergarten-garden/kindergarten_garden_test.py +++ b/kindergarten-garden/kindergarten_garden_test.py @@ -9,11 +9,13 @@ def test_alices_garden(self): self.assertEqual("Radishes Clover Grass Grass".split(), Garden("RC\nGG").plants("Alice")) + @unittest.skip("") def test_bob_and_charlies_gardens(self): garden = Garden("VVCCGG\nVVCCGG") self.assertEqual(["Clover"] * 4, garden.plants("Bob")) self.assertEqual(["Grass"] * 4, garden.plants("Charlie")) + @unittest.skip("") def test_full_garden(self): garden = Garden("VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV") self.assertEqual("Violets Radishes Violets Radishes".split(), @@ -25,6 +27,7 @@ def test_full_garden(self): self.assertEqual("Grass Violets Clover Violets".split(), garden.plants("Larry")) + @unittest.skip("") def test_disordered_test(self): garden = Garden("VCRRGVRG\nRVGCCGCV", students="Samantha Patricia Xander Roger".split()) diff --git a/largest-series-product/largest_series_product_test.py b/largest-series-product/largest_series_product_test.py index bc5b72dc1a..af5495aad8 100644 --- a/largest-series-product/largest_series_product_test.py +++ b/largest-series-product/largest_series_product_test.py @@ -17,26 +17,33 @@ def test_slices_of_two(self): [7, 5], [5, 6], [6, 4]], slices("97867564", 2)) + @unittest.skip("") def test_overly_long_slice(self): with self.assertRaises(ValueError): slices("012", 4) + @unittest.skip("") def test_largest_product_of_2(self): self.assertEqual(72, largest_product("0123456789", 2)) + @unittest.skip("") def test_tiny_number(self): self.assertEqual(9, largest_product("19", 2)) + @unittest.skip("") def test_largest_product_of_3(self): self.assertEqual(270, largest_product("1027839564", 3)) + @unittest.skip("") def test_big_number(self): series = "52677741234314237566414902593461595376319419139427" self.assertEqual(28350, largest_product(series, 6)) + @unittest.skip("") def test_identity(self): self.assertEqual(1, largest_product("", 0)) + @unittest.skip("") def test_slices_bigger_than_number(self): with self.assertRaises(ValueError): largest_product("012", 4) diff --git a/leap/leap_test.py b/leap/leap_test.py index f38516b642..01f1e26a38 100644 --- a/leap/leap_test.py +++ b/leap/leap_test.py @@ -7,15 +7,19 @@ class YearTest(unittest.TestCase): def test_leap_year(self): self.assertIs(is_leap_year(1996), True) + @unittest.skip("") def test_non_leap_year(self): self.assertIs(is_leap_year(1997), False) + @unittest.skip("") def test_non_leap_even_year(self): self.assertIs(is_leap_year(1998), False) + @unittest.skip("") def test_century(self): self.assertIs(is_leap_year(1900), False) + @unittest.skip("") def test_exceptional_century(self): self.assertIs(is_leap_year(2400), True) diff --git a/luhn/luhn_test.py b/luhn/luhn_test.py index 25f4656e58..3d6130a08f 100644 --- a/luhn/luhn_test.py +++ b/luhn/luhn_test.py @@ -10,32 +10,41 @@ def test_addends(self): self.assertEqual(Counter([1, 4, 1, 4, 1]), Counter(Luhn(12121).addends())) + @unittest.skip("") def test_addends_large(self): # uses a Counter to avoid specifying order of return value self.assertEqual(Counter([7, 6, 6, 1]), Counter(Luhn(8631).addends())) + @unittest.skip("") def test_checksum1(self): self.assertEqual(2, Luhn(4913).checksum()) + @unittest.skip("") def test_ckecksum2(self): self.assertEqual(1, Luhn(201773).checksum()) + @unittest.skip("") def test_invalid_number(self): self.assertFalse(Luhn(738).is_valid()) + @unittest.skip("") def test_valid_number(self): self.assertTrue(Luhn(8739567).is_valid()) + @unittest.skip("") def test_create_valid_number1(self): self.assertEqual(1230, Luhn.create(123)) + @unittest.skip("") def test_create_valid_number2(self): self.assertEqual(8739567, Luhn.create(873956)) + @unittest.skip("") def test_create_valid_number3(self): self.assertEqual(8372637564, Luhn.create(837263756)) + @unittest.skip("") def test_is_valid_can_be_called_repeatedly(self): # This test was added, because we saw many implementations # in which the first call to is_valid() worked, but the diff --git a/matrix/matrix_test.py b/matrix/matrix_test.py index 2d832c3401..93c21aeec7 100644 --- a/matrix/matrix_test.py +++ b/matrix/matrix_test.py @@ -8,22 +8,27 @@ def test_extract_a_row(self): matrix = Matrix("1 2\n10 20") self.assertEqual([1, 2], matrix.rows[0]) + @unittest.skip("") def test_extract_same_row_again(self): matrix = Matrix("9 7\n8 6") self.assertEqual([9, 7], matrix.rows[0]) + @unittest.skip("") def test_extract_other_row(self): matrix = Matrix("9 8 7\n19 18 17") self.assertEqual([19, 18, 17], matrix.rows[1]) + @unittest.skip("") def test_extract_other_row_again(self): matrix = Matrix("1 4 9\n16 25 36") self.assertEqual([16, 25, 36], matrix.rows[1]) + @unittest.skip("") def test_extract_a_column(self): matrix = Matrix("1 2 3\n4 5 6\n7 8 9\n8 7 6") self.assertEqual([1, 4, 7, 8], matrix.columns[0]) + @unittest.skip("") def test_extract_another_column(self): matrix = Matrix("89 1903 3\n18 3 1\n9 4 800") self.assertEqual([1903, 3, 4], matrix.columns[1]) diff --git a/meetup/meetup_test.py b/meetup/meetup_test.py index 9676233ae2..593625d2d5 100644 --- a/meetup/meetup_test.py +++ b/meetup/meetup_test.py @@ -13,42 +13,52 @@ def test_monteenth_of_may_2013(self): self.assertEqual(date(2013, 5, 13), meetup_day(2013, 5, 'Monday', 'teenth')) + @unittest.skip("") def test_saturteenth_of_february_2013(self): self.assertEqual(date(2013, 2, 16), meetup_day(2013, 2, 'Saturday', 'teenth')) + @unittest.skip("") def test_first_tuesday_of_may_2013(self): self.assertEqual(date(2013, 5, 7), meetup_day(2013, 5, 'Tuesday', '1st')) + @unittest.skip("") def test_second_monday_of_april_2013(self): self.assertEqual(date(2013, 4, 8), meetup_day(2013, 4, 'Monday', '2nd')) + @unittest.skip("") def test_third_thursday_of_september_2013(self): self.assertEqual(date(2013, 9, 19), meetup_day(2013, 9, 'Thursday', '3rd')) + @unittest.skip("") def test_fourth_sunday_of_march_2013(self): self.assertEqual(date(2013, 3, 24), meetup_day(2013, 3, 'Sunday', '4th')) + @unittest.skip("") def test_last_thursday_of_october_2013(self): self.assertEqual(date(2013, 10, 31), meetup_day(2013, 10, 'Thursday', 'last')) + @unittest.skip("") def test_last_wednesday_of_february_2012(self): self.assertEqual(date(2012, 2, 29), meetup_day(2012, 2, 'Wednesday', 'last')) + @unittest.skip("") def test_first_friday_of_december_2012(self): self.assertEqual(date(2012, 12, 7), meetup_day(2012, 12, 'Friday', '1st')) + @unittest.skip("") def test_fifth_monday_of_march_2015(self): self.assertEqual(date(2015, 3, 30), meetup_day(2015, 3, 'Monday', '5th')) + @unittest.skip("") def test_nonexistent_fifth_monday_of_february_2015(self): self.assertRaises(MeetupDayException, meetup_day, 2015, 2, 'Monday', '5th') diff --git a/minesweeper/minesweeper_test.py b/minesweeper/minesweeper_test.py index 7c0cb8e188..91c713f8ed 100644 --- a/minesweeper/minesweeper_test.py +++ b/minesweeper/minesweeper_test.py @@ -32,6 +32,7 @@ def test_board1(self): "+------+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board2(self): inp = ["+-----+", "| * * |", @@ -49,6 +50,7 @@ def test_board2(self): "+-----+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board3(self): inp = ["+-----+", "| * * |", @@ -58,6 +60,7 @@ def test_board3(self): "+-----+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board4(self): inp = ["+-+", "|*|", @@ -75,6 +78,7 @@ def test_board4(self): "+-+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board5(self): inp = ["+-+", "|*|", @@ -84,6 +88,7 @@ def test_board5(self): "+-+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board6(self): inp = ["+--+", "|**|", @@ -95,6 +100,7 @@ def test_board6(self): "+--+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board7(self): inp = ["+--+", "|**|", @@ -106,6 +112,7 @@ def test_board7(self): "+--+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board8(self): inp = ["+---+", "|***|", @@ -119,6 +126,7 @@ def test_board8(self): "+---+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_board9(self): inp = ["+-----+", "| |", @@ -136,6 +144,7 @@ def test_board9(self): "+-----+"] self.assertEqual(out, board(inp)) + @unittest.skip("") def test_different_len(self): inp = ["+-+", "| |", @@ -144,12 +153,14 @@ def test_different_len(self): "+-+"] self.assertRaises(ValueError, board, inp) + @unittest.skip("") def test_faulty_border(self): inp = ["+-----+", "* * |", "+-- --+"] self.assertRaises(ValueError, board, inp) + @unittest.skip("") def test_invalid_char(self): inp = ["+-----+", "|X * |", diff --git a/nth-prime/nth_prime_test.py b/nth-prime/nth_prime_test.py index 06006ccb3d..f22f0c336f 100644 --- a/nth-prime/nth_prime_test.py +++ b/nth-prime/nth_prime_test.py @@ -7,13 +7,16 @@ class NthPrimeTests(unittest.TestCase): def test_first_prime(self): self.assertEqual(2, nth_prime(1)) + @unittest.skip("") def test_sixth_prime(self): self.assertEqual(13, nth_prime(6)) + @unittest.skip("") def test_first_twenty_primes(self): self.assertEqual([2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71], [nth_prime(n) for n in range(1, 21)]) + @unittest.skip("") def test_prime_no_10000(self): self.assertEqual(104729, nth_prime(10000)) diff --git a/nucleotide-count/nucleotide_count_test.py b/nucleotide-count/nucleotide_count_test.py index 0e7d9abeff..3bcb863ff0 100644 --- a/nucleotide-count/nucleotide_count_test.py +++ b/nucleotide-count/nucleotide_count_test.py @@ -13,24 +13,30 @@ class DNATest(unittest.TestCase): def test_empty_dna_string_has_no_adenosine(self): self.assertEqual(0, count('', 'A')) + @unittest.skip("") def test_empty_dna_string_has_no_nucleotides(self): expected = {'A': 0, 'T': 0, 'C': 0, 'G': 0} self.assertEqual(expected, nucleotide_counts("")) + @unittest.skip("") def test_repetitive_cytidine_gets_counted(self): self.assertEqual(5, count('CCCCC', 'C')) + @unittest.skip("") def test_repetitive_sequence_has_only_guanosine(self): expected = {'A': 0, 'T': 0, 'C': 0, 'G': 8} self.assertEqual(expected, nucleotide_counts('GGGGGGGG')) + @unittest.skip("") def test_counts_only_thymidine(self): self.assertEqual(1, count('GGGGGTAACCCGG', 'T')) + @unittest.skip("") def test_validates_nucleotides(self): with self.assertRaises(ValueError): count("GACT", 'X') + @unittest.skip("") def test_counts_all_nucleotides(self): dna = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC" expected = {'A': 20, 'T': 21, 'G': 17, 'C': 12} diff --git a/ocr-numbers/ocr_test.py b/ocr-numbers/ocr_test.py index f609e46d58..b08d832e5f 100644 --- a/ocr-numbers/ocr_test.py +++ b/ocr-numbers/ocr_test.py @@ -31,41 +31,49 @@ class OcrTest(unittest.TestCase): def test_0(self): self.assertEqual('0', number(ZERO)) + @unittest.skip("") def test_1(self): self.assertEqual('1', number(ONE)) + @unittest.skip("") def test_garbage(self): self.assertEqual('?', number([" _ ", " _|", " |", " "])) + @unittest.skip("") def test_last_line_nonblank(self): self.assertEqual('?', number([" ", " |", " |", "| |"])) + @unittest.skip("") def test_unknown_char(self): self.assertEqual('?', number([" - ", " _|", " X|", " "])) + @unittest.skip("") def test_too_short_row(self): self.assertRaises(ValueError, number, [" ", " _|", " |", " "]) + @unittest.skip("") def test_insufficient_rows(self): self.assertRaises(ValueError, number, [" ", " _|", " X|"]) + @unittest.skip("") def test_grid0(self): self.assertEqual(ZERO, grid('0')) + @unittest.skip("") def test_grid1(self): self.assertEqual(ONE, grid('1')) diff --git a/octal/octal_test.py b/octal/octal_test.py index d6abbbf14d..eb332a06cd 100644 --- a/octal/octal_test.py +++ b/octal/octal_test.py @@ -13,30 +13,39 @@ class OctalTest(unittest.TestCase): def test_octal_1_is_decimal_1(self): self.assertEqual(1, parse_octal("1")) + @unittest.skip("") def test_octal_10_is_decimal_8(self): self.assertEqual(8, parse_octal("10")) + @unittest.skip("") def test_octal_17_is_decimal_15(self): self.assertEqual(15, parse_octal("17")) + @unittest.skip("") def test_octal_130_is_decimal_88(self): self.assertEqual(88, parse_octal("130")) + @unittest.skip("") def test_octal_2047_is_decimal_1063(self): self.assertEqual(1063, parse_octal("2047")) + @unittest.skip("") def test_octal_1234567_is_decimal_342391(self): self.assertEqual(342391, parse_octal("1234567")) + @unittest.skip("") def test_8_is_seen_as_invalid(self): self.assertRaises(ValueError, parse_octal, "8") + @unittest.skip("") def test_invalid_octal_is_recognized(self): self.assertRaises(ValueError, parse_octal, "carrot") + @unittest.skip("") def test_6789_is_seen_as_invalid(self): self.assertRaises(ValueError, parse_octal, "6789") + @unittest.skip("") def test_valid_octal_formatted_string_011_is_decimal_9(self): self.assertEqual(9, parse_octal("011")) diff --git a/palindrome-products/palindrome_products_test.py b/palindrome-products/palindrome_products_test.py index 36f9405519..7ce48a2fcc 100644 --- a/palindrome-products/palindrome_products_test.py +++ b/palindrome-products/palindrome_products_test.py @@ -22,21 +22,25 @@ def test_largest_palindrome_from_single_digit_factors(self): self.assertEqual(9, value) self.assertIn(set(factors), [{1, 9}, {3, 3}]) + @unittest.skip("") def test_largest_palindrome_from_double_digit_factors(self): value, factors = largest_palindrome(max_factor=99, min_factor=10) self.assertEqual(9009, value) self.assertEqual({91, 99}, set(factors)) + @unittest.skip("") def test_smallest_palindrome_from_double_digit_factors(self): value, factors = smallest_palindrome(max_factor=99, min_factor=10) self.assertEqual(121, value) self.assertEqual({11}, set(factors)) + @unittest.skip("") def test_largest_palindrome_from_triple_digit_factors(self): value, factors = largest_palindrome(max_factor=999, min_factor=100) self.assertEqual(906609, value) self.assertEqual({913, 993}, set(factors)) + @unittest.skip("") def test_smallest_palindrome_from_triple_digit_factors(self): value, factors = smallest_palindrome(max_factor=999, min_factor=100) self.assertEqual(10201, value) diff --git a/pascals-triangle/pascals_triangle_test.py b/pascals-triangle/pascals_triangle_test.py index 91c29d3c4f..f8e685fa96 100644 --- a/pascals-triangle/pascals_triangle_test.py +++ b/pascals-triangle/pascals_triangle_test.py @@ -8,27 +8,33 @@ def test_triangle1(self): ans = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1'] self.assertEqual(ans, triangle(4)) + @unittest.skip("") def test_triangle2(self): ans = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1', '1 5 10 10 5 1', '1 6 15 20 15 6 1'] self.assertEqual(ans, triangle(6)) + @unittest.skip("") def test_is_triangle_true(self): inp = ['1', '1 1', '1 2 1', '1 3 3 1', '1 4 6 4 1', '1 5 10 10 5 1'] self.assertEqual(True, is_triangle(inp)) + @unittest.skip("") def test_is_triangle_false(self): inp = ['1', '1 1', '1 2 1', '1 4 4 1'] self.assertEqual(False, is_triangle(inp)) + @unittest.skip("") def test_row1(self): ans = '1' self.assertEqual(ans, row(0)) + @unittest.skip("") def test_row2(self): ans = '1 2 1' self.assertEqual(ans, row(2)) + @unittest.skip("") def test_row3(self): ans = '1 7 21 35 35 21 7 1' self.assertEqual(ans, row(7)) diff --git a/phone-number/phone_number_test.py b/phone-number/phone_number_test.py index 865f6ecf90..b908d39302 100644 --- a/phone-number/phone_number_test.py +++ b/phone-number/phone_number_test.py @@ -8,30 +8,37 @@ def test_cleans_number(self): number = Phone("(123) 456-7890").number self.assertEqual("1234567890", number) + @unittest.skip("") def test_cleans_number_with_dots(self): number = Phone("123.456.7890").number self.assertEqual("1234567890", number) + @unittest.skip("") def test_valid_when_11_digits_and_first_is_1(self): number = Phone("11234567890").number self.assertEqual("1234567890", number) + @unittest.skip("") def test_invalid_when_11_digits(self): number = Phone("21234567890").number self.assertEqual("0000000000", number) + @unittest.skip("") def test_invalid_when_9_digits(self): number = Phone("123456789").number self.assertEqual("0000000000", number) + @unittest.skip("") def test_area_code(self): number = Phone("1234567890") self.assertEqual("123", number.area_code()) + @unittest.skip("") def test_pretty_print(self): number = Phone("1234567890") self.assertEqual("(123) 456-7890", number.pretty()) + @unittest.skip("") def test_pretty_print_with_full_us_phone_number(self): number = Phone("11234567890") self.assertEqual("(123) 456-7890", number.pretty()) diff --git a/point-mutations/point_mutations_test.py b/point-mutations/point_mutations_test.py index da8935e46c..ac4c0569d5 100644 --- a/point-mutations/point_mutations_test.py +++ b/point-mutations/point_mutations_test.py @@ -7,26 +7,33 @@ class DNATest(unittest.TestCase): def test_no_difference_between_empty_strands(self): self.assertEqual(0, hamming_distance('', '')) + @unittest.skip("") def test_no_difference_between_identical_strands(self): self.assertEqual(0, hamming_distance('GGACTGA', 'GGACTGA')) + @unittest.skip("") def test_complete_hamming_distance_in_small_strand(self): self.assertEqual(3, hamming_distance('ACT', 'GGA')) + @unittest.skip("") def test_hamming_distance_in_off_by_one_strand(self): self.assertEqual(19, hamming_distance('GGACGGATTCTGACCTGGACTAATTTTGGGG', 'AGGACGGATTCTGACCTGGACTAATTTTGGGG')) + @unittest.skip("") def test_small_hamming_distance_in_middle_somewhere(self): self.assertEqual(1, hamming_distance('GGACG', 'GGTCG')) + @unittest.skip("") def test_larger_distance(self): self.assertEqual(2, hamming_distance('ACCAGGG', 'ACTATGG')) + @unittest.skip("") def test_ignores_extra_length_on_other_strand_when_longer(self): self.assertEqual(3, hamming_distance('AAACTAGGGG', 'AGGCTAGCGGTAGGAC')) + @unittest.skip("") def test_ignores_extra_length_on_original_strand_when_longer(self): self.assertEqual(5, hamming_distance('GACTACGGACAGGGTAGGGAAT', 'GACATCGCACACC')) diff --git a/prime-factors/prime_factors_test.py b/prime-factors/prime_factors_test.py index 65cf3f723f..9f39f704f7 100644 --- a/prime-factors/prime_factors_test.py +++ b/prime-factors/prime_factors_test.py @@ -7,33 +7,43 @@ class PrimeFactorsTest(unittest.TestCase): def test_1(self): self.assertEqual([], prime_factors(1)) + @unittest.skip("") def test_2(self): self.assertEqual([2], prime_factors(2)) + @unittest.skip("") def test_3(self): self.assertEqual([3], prime_factors(3)) + @unittest.skip("") def test_4(self): self.assertEqual([2, 2], prime_factors(4)) + @unittest.skip("") def test_6(self): self.assertEqual([2, 3], prime_factors(6)) + @unittest.skip("") def test_8(self): self.assertEqual([2, 2, 2], prime_factors(8)) + @unittest.skip("") def test_9(self): self.assertEqual([3, 3], prime_factors(9)) + @unittest.skip("") def test_27(self): self.assertEqual([3, 3, 3], prime_factors(27)) + @unittest.skip("") def test_625(self): self.assertEqual([5, 5, 5, 5], prime_factors(625)) + @unittest.skip("") def test_901255(self): self.assertEqual([5, 17, 23, 461], prime_factors(901255)) + @unittest.skip("") def test_93819012551(self): self.assertEqual([11, 9539, 894119], prime_factors(93819012551)) diff --git a/proverb/proverb_test.py b/proverb/proverb_test.py index bd29c3998d..d5aa42c2f3 100644 --- a/proverb/proverb_test.py +++ b/proverb/proverb_test.py @@ -9,12 +9,14 @@ def test_a_single_consequence(self): 'And all for the want of a nail.' self.assertEqual(expected, proverb(['nail', 'shoe'])) + @unittest.skip("") def test_short_list(self): expected = 'For want of a nail the shoe was lost.\n'\ 'For want of a shoe the horse was lost.\n'\ 'And all for the want of a nail.' self.assertEqual(expected, proverb(['nail', 'shoe', 'horse'])) + @unittest.skip("") def test_long_list(self): expected = 'For want of a nail the shoe was lost.\n'\ 'For want of a shoe the horse was lost.\n'\ @@ -22,11 +24,13 @@ def test_long_list(self): 'And all for the want of a nail.' self.assertEqual(expected, proverb(['nail', 'shoe', 'horse', 'rider'])) + @unittest.skip("") def test_new_itens(self): expected = 'For want of a key the value was lost.\n'\ 'And all for the want of a key.' self.assertEqual(expected, proverb(['key', 'value'])) + @unittest.skip("") def test_whole_proverb(self): expected = 'For want of a nail the shoe was lost.\n'\ 'For want of a shoe the horse was lost.\n'\ @@ -38,6 +42,7 @@ def test_whole_proverb(self): self.assertEqual(expected, proverb(['nail', 'shoe', 'horse', 'rider', 'message', 'battle', 'kingdom'])) + @unittest.skip("") def test_qualifier(self): expected = 'For want of a nail the shoe was lost.\n'\ 'For want of a shoe the horse was lost.\n'\ diff --git a/pythagorean-triplet/pythagorean_triplet_test.py b/pythagorean-triplet/pythagorean_triplet_test.py index 4ba51a770c..96bd3cbea3 100644 --- a/pythagorean-triplet/pythagorean_triplet_test.py +++ b/pythagorean-triplet/pythagorean_triplet_test.py @@ -45,38 +45,47 @@ def test_triplet1(self): ans = set([(3, 4, 5)]) self.assertEqual(ans, primitive_triplets(4)) + @unittest.skip("") def test_triplet2(self): ans = set([(13, 84, 85), (84, 187, 205), (84, 437, 445), (84, 1763, 1765)]) self.assertEqual(ans, primitive_triplets(84)) + @unittest.skip("") def test_triplet3(self): ans = set([(29, 420, 421), (341, 420, 541), (420, 851, 949), (420, 1189, 1261), (420, 1739, 1789), (420, 4891, 4909), (420, 11021, 11029), (420, 44099, 44101)]) self.assertEqual(ans, primitive_triplets(420)) + @unittest.skip("") def test_triplet4(self): ans = set([(175, 288, 337), (288, 20735, 20737)]) self.assertEqual(ans, primitive_triplets(288)) + @unittest.skip("") def test_range1(self): ans = set([(3, 4, 5), (6, 8, 10)]) self.assertEqual(ans, triplets_in_range(1, 10)) + @unittest.skip("") def test_range2(self): ans = set([(57, 76, 95), (60, 63, 87)]) self.assertEqual(ans, triplets_in_range(56, 95)) + @unittest.skip("") def test_is_triplet1(self): self.assertEqual(True, is_triplet((29, 20, 21))) + @unittest.skip("") def test_is_triplet2(self): self.assertEqual(False, is_triplet((25, 25, 1225))) + @unittest.skip("") def test_is_triplet3(self): self.assertEqual(True, is_triplet((924, 43, 925))) + @unittest.skip("") def test_odd_number(self): self.assertRaises(ValueError, primitive_triplets, 5) diff --git a/queen-attack/queen_attack_test.py b/queen-attack/queen_attack_test.py index 84e7f43b68..dfd18a3bbf 100644 --- a/queen-attack/queen_attack_test.py +++ b/queen-attack/queen_attack_test.py @@ -15,6 +15,7 @@ def test_board1(self): '________'] self.assertEqual(ans, board((2, 3), (5, 6))) + @unittest.skip("") def test_board2(self): ans = ['______W_', '_______B', @@ -26,44 +27,56 @@ def test_board2(self): '________'] self.assertEqual(ans, board((0, 6), (1, 7))) + @unittest.skip("") def test_attack_true1(self): self.assertEqual(True, can_attack((2, 3), (5, 6))) + @unittest.skip("") def test_attack_true2(self): self.assertEqual(True, can_attack((2, 6), (5, 3))) + @unittest.skip("") def test_attack_true3(self): self.assertEqual(True, can_attack((2, 4), (2, 7))) + @unittest.skip("") def test_attack_true4(self): self.assertEqual(True, can_attack((5, 4), (2, 4))) + @unittest.skip("") def test_attack_true5(self): self.assertEqual(True, can_attack((1, 1), (6, 6))) + @unittest.skip("") def test_attack_true6(self): self.assertEqual(True, can_attack((0, 6), (1, 7))) + @unittest.skip("") def test_attack_false1(self): self.assertEqual(False, can_attack((4, 2), (0, 5))) + @unittest.skip("") def test_attack_false2(self): self.assertEqual(False, can_attack((2, 3), (4, 7))) # If either board or can_attack are called with an invalid board position # they should raise a ValueError with a meaningful error message. + @unittest.skip("") def test_invalid_position_board(self): with self.assertRaises(ValueError): board((0, 0), (7, 8)) + @unittest.skip("") def test_invalid_position_can_attack(self): with self.assertRaises(ValueError): can_attack((0, 0), (7, 8)) + @unittest.skip("") def test_queens_same_position_board(self): with self.assertRaises(ValueError): board((2, 2), (2, 2)) + @unittest.skip("") def test_queens_same_position_can_attack(self): with self.assertRaises(ValueError): can_attack((2, 2), (2, 2)) diff --git a/raindrops/raindrops_test.py b/raindrops/raindrops_test.py index a13eb737e7..99f0d4c3f9 100644 --- a/raindrops/raindrops_test.py +++ b/raindrops/raindrops_test.py @@ -7,48 +7,63 @@ class RaindropsTest(unittest.TestCase): def test_1(self): self.assertEqual("1", raindrops(1)) + @unittest.skip("") def test_3(self): self.assertEqual("Pling", raindrops(3)) + @unittest.skip("") def test_5(self): self.assertEqual("Plang", raindrops(5)) + @unittest.skip("") def test_7(self): self.assertEqual("Plong", raindrops(7)) + @unittest.skip("") def test_6(self): self.assertEqual("Pling", raindrops(6)) + @unittest.skip("") def test_9(self): self.assertEqual("Pling", raindrops(9)) + @unittest.skip("") def test_10(self): self.assertEqual("Plang", raindrops(10)) + @unittest.skip("") def test_14(self): self.assertEqual("Plong", raindrops(14)) + @unittest.skip("") def test_15(self): self.assertEqual("PlingPlang", raindrops(15)) + @unittest.skip("") def test_21(self): self.assertEqual("PlingPlong", raindrops(21)) + @unittest.skip("") def test_25(self): self.assertEqual("Plang", raindrops(25)) + @unittest.skip("") def test_35(self): self.assertEqual("PlangPlong", raindrops(35)) + @unittest.skip("") def test_49(self): self.assertEqual("Plong", raindrops(49)) + @unittest.skip("") def test_52(self): self.assertEqual("52", raindrops(52)) + @unittest.skip("") def test_105(self): self.assertEqual("PlingPlangPlong", raindrops(105)) + @unittest.skip("") def test_12121(self): self.assertEqual("12121", raindrops(12121)) diff --git a/rna-transcription/rna_transcription_test.py b/rna-transcription/rna_transcription_test.py index 1928f03e5d..2f878af52f 100644 --- a/rna-transcription/rna_transcription_test.py +++ b/rna-transcription/rna_transcription_test.py @@ -8,15 +8,19 @@ class DNATests(unittest.TestCase): def test_transcribes_guanine_to_cytosine(self): self.assertEqual('C', to_rna('G')) + @unittest.skip("") def test_transcribes_cytosine_to_guanine(self): self.assertEqual('G', to_rna('C')) + @unittest.skip("") def test_transcribes_thymine_to_adenine(self): self.assertEqual('A', to_rna('T')) + @unittest.skip("") def test_transcribes_adenine_to_uracil(self): self.assertEqual('U', to_rna('A')) + @unittest.skip("") def test_transcribes_all_occurences(self): self.assertEqual('UGCACCAGAAUU', to_rna('ACGTGGTCTTAA')) diff --git a/robot-name/robot_name_test.py b/robot-name/robot_name_test.py index aa636a2949..33f834af20 100644 --- a/robot-name/robot_name_test.py +++ b/robot-name/robot_name_test.py @@ -10,17 +10,20 @@ class RobotTest(unittest.TestCase): def test_has_name(self): self.assertRegexpMatches(Robot().name, self.name_re) + @unittest.skip("") def test_name_sticks(self): robot = Robot() robot.name self.assertEqual(robot.name, robot.name) + @unittest.skip("") def test_different_robots_have_different_names(self): self.assertNotEqual( Robot().name, Robot().name ) + @unittest.skip("") def test_rest_name(self): # Set a seed seed = "Totally random." diff --git a/saddle-points/saddle_points_test.py b/saddle-points/saddle_points_test.py index 21f1b305ba..a1cccc58c0 100644 --- a/saddle-points/saddle_points_test.py +++ b/saddle-points/saddle_points_test.py @@ -15,17 +15,21 @@ def test_one_saddle(self): inp = [[9, 8, 7], [5, 3, 2], [6, 6, 7]] self.assertEqual(set([(1, 0)]), saddle_points(inp)) + @unittest.skip("") def test_no_saddle(self): self.assertEqual(set(), saddle_points([[2, 1], [1, 2]])) + @unittest.skip("") def test_mult_saddle(self): inp = [[5, 3, 5, 4], [6, 4, 7, 3], [5, 1, 5, 3]] ans = set([(0, 0), (0, 2), (2, 0), (2, 2)]) self.assertEqual(ans, saddle_points(inp)) + @unittest.skip("") def test_empty_matrix(self): self.assertEqual(set(), saddle_points([])) + @unittest.skip("") def test_irregular_matrix(self): inp = [[3, 2, 1], [0, 1], [2, 1, 0]] self.assertRaises(ValueError, saddle_points, inp) diff --git a/scrabble-score/scrabble_score_test.py b/scrabble-score/scrabble_score_test.py index b2e894bcdc..7eba48f0b4 100644 --- a/scrabble-score/scrabble_score_test.py +++ b/scrabble-score/scrabble_score_test.py @@ -7,21 +7,27 @@ class WordTest(unittest.TestCase): def test_empty_word_scores_zero(self): self.assertEqual(0, score("")) + @unittest.skip("") def test_whitespace_scores_zero(self): self.assertEqual(0, score(" \t\n")) + @unittest.skip("") def test_scores_very_short_word(self): self.assertEqual(1, score('a')) + @unittest.skip("") def test_scores_other_very_short_word(self): self.assertEqual(4, score('f')) + @unittest.skip("") def test_simple_word_scores_the_number_of_letters(self): self.assertEqual(6, score("street")) + @unittest.skip("") def test_complicated_word_scores_more(self): self.assertEqual(22, score("quirky")) + @unittest.skip("") def test_scores_are_case_insensitive(self): self.assertEqual(20, score("MULTIBILLIONAIRE")) diff --git a/secret-handshake/handshake_test.py b/secret-handshake/handshake_test.py index 1ff0935bc9..85258fa2b4 100644 --- a/secret-handshake/handshake_test.py +++ b/secret-handshake/handshake_test.py @@ -8,39 +8,51 @@ class HandshakeTest(unittest.TestCase): def test_shake_int(self): self.assertEqual(['wink','jump'], handshake(9)) + @unittest.skip("") def test_shake_bin1(self): self.assertEqual(['close your eyes','double blink'], handshake('10110')) + @unittest.skip("") def test_shake_bin2(self): self.assertEqual(['wink','close your eyes'], handshake('101')) + @unittest.skip("") def test_shake_negative_int(self): self.assertEqual([], handshake(-9)) + @unittest.skip("") def test_shake_bin_invalid(self): self.assertEqual([], handshake('121')) + @unittest.skip("") def test_unknown_action(self): self.assertEqual('0', code(['wink','sneeze'])) + @unittest.skip("") def test_code1(self): self.assertEqual('1100', code(['close your eyes','jump'])) + @unittest.skip("") def test_code2(self): self.assertEqual('11', code(['wink','double blink'])) + @unittest.skip("") def test_code3(self): self.assertEqual('11010', code(['jump','double blink'])) + @unittest.skip("") def test_composition1(self): self.assertEqual('11011', code(handshake(27))) + @unittest.skip("") def test_composition2(self): self.assertEqual('1', code(handshake(1))) + @unittest.skip("") def test_composition3(self): self.assertEqual('111', code(handshake('111'))) + @unittest.skip("") def test_composition4(self): inp = ['wink','double blink','jump'] self.assertEqual(inp, handshake(code(inp))) diff --git a/series/series_test.py b/series/series_test.py index 7f9a3892f0..407f8d955a 100644 --- a/series/series_test.py +++ b/series/series_test.py @@ -14,28 +14,34 @@ def test_slices_of_one(self): self.assertEqual([[0], [1], [2], [3], [4]], slices("01234", 1)) + @unittest.skip("") def test_slices_of_two(self): self.assertEqual([[9, 7], [7, 8], [8, 6], [6, 7], [7, 5], [5, 6], [6, 4]], slices("97867564", 2)) + @unittest.skip("") def test_slices_of_three(self): self.assertEqual([[9, 7, 8], [7, 8, 6], [8, 6, 7], [6, 7, 5], [7, 5, 6], [5, 6, 4]], slices("97867564", 3)) + @unittest.skip("") def test_slices_of_four(self): self.assertEqual([[0, 1, 2, 3], [1, 2, 3, 4]], slices("01234", 4)) + @unittest.skip("") def test_slices_of_five(self): self.assertEqual([[0, 1, 2, 3, 4]], slices("01234", 5)) + @unittest.skip("") def test_overly_long_slice(self): with self.assertRaises(ValueError): slices("012", 4) + @unittest.skip("") def test_overly_short_slice(self): with self.assertRaises(ValueError): slices("01234", 0) diff --git a/sieve/sieve_test.py b/sieve/sieve_test.py index b3108df8f7..f2e604adc9 100644 --- a/sieve/sieve_test.py +++ b/sieve/sieve_test.py @@ -8,10 +8,12 @@ def test_a_few_primes(self): expected = [2, 3, 5, 7] self.assertEqual(expected, sieve(10)) + @unittest.skip("") def test_prime_limit(self): expected = [2, 3, 5, 7] self.assertEqual(expected, sieve(7)) + @unittest.skip("") def test_primes(self): expected = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997] self.assertEqual(expected, sieve(1000)) diff --git a/simple-cipher/simple_cipher_test.py b/simple-cipher/simple_cipher_test.py index 1077bb3a2b..b4326cdc00 100644 --- a/simple-cipher/simple_cipher_test.py +++ b/simple-cipher/simple_cipher_test.py @@ -9,44 +9,54 @@ def test_caesar_encode1(self): self.assertEqual('lwlvdzhvrphsurjudpplqjlqsbwkrq', Caesar().encode('itisawesomeprogramminginpython')) + @unittest.skip("") def test_caesar_encode2(self): self.assertEqual('yhqlylglylfl', Caesar().encode('venividivici')) + @unittest.skip("") def test_caesar_encode3(self): self.assertEqual('wzdvwkhqljkwehiruhfkulvwpdv', Caesar().encode('\'Twas the night before Christmas')) + @unittest.skip("") def test_caesar_encode_with_numbers(self): self.assertEqual('jr', Caesar().encode('1, 2, 3, Go!')) + @unittest.skip("") def test_caesar_decode(self): self.assertEqual('venividivici', Caesar().decode('yhqlylglylfl')) + @unittest.skip("") def test_cipher_encode1(self): c = Cipher('a') self.assertEqual('itisawesomeprogramminginpython', c.encode('itisawesomeprogramminginpython')) + @unittest.skip("") def test_cipher_encode2(self): c = Cipher('aaaaaaaaaaaaaaaaaaaaaa') self.assertEqual('itisawesomeprogramminginpython', c.encode('itisawesomeprogramminginpython')) + @unittest.skip("") def test_cipher_encode3(self): c = Cipher('dddddddddddddddddddddd') self.assertEqual('yhqlylglylfl', c.encode('venividivici')) + @unittest.skip("") def test_cipher_encode4(self): key = 'duxrceqyaimciuucnelkeoxjhdyduucpmrxmaivacmybmsdrzwqxvbxsygzsabdjmdjabeorttiwinfrpmpogvabiofqexnohrqu' c = Cipher(key) self.assertEqual('gccwkixcltycv', c.encode('diffiehellman')) + @unittest.skip("") def test_cipher_compositiion1(self): key = 'duxrceqyaimciuucnelkeoxjhdyduucpmrxmaivacmybmsdrzwqxvbxsygzsabdjmdjabeorttiwinfrpmpogvabiofqexnohrqu' plaintext = 'adaywithoutlaughterisadaywasted' c = Cipher(key) self.assertEqual(plaintext, c.decode(c.encode(plaintext))) + @unittest.skip("") def test_cipher_compositiion2(self): plaintext = 'adaywithoutlaughterisadaywasted' c = Cipher() diff --git a/space-age/space_age_test.py b/space-age/space_age_test.py index 035e3757ee..f005427a63 100644 --- a/space-age/space_age_test.py +++ b/space-age/space_age_test.py @@ -8,40 +8,48 @@ def test_age_in_seconds(self): age = SpaceAge(1e6) self.assertEqual(1e6, age.seconds) + @unittest.skip("") def test_age_in_earth_years(self): age = SpaceAge(1e9) self.assertEqual(31.69, age.on_earth()) + @unittest.skip("") def test_age_in_mercury_years(self): age = SpaceAge(2134835688) self.assertEqual(67.65, age.on_earth()) self.assertEqual(280.88, age.on_mercury()) + @unittest.skip("") def test_age_in_venus_years(self): age = SpaceAge(189839836) self.assertEqual(6.02, age.on_earth()) self.assertEqual(9.78, age.on_venus()) + @unittest.skip("") def test_age_on_mars(self): age = SpaceAge(2329871239) self.assertEqual(73.83, age.on_earth()) self.assertEqual(39.25, age.on_mars()) + @unittest.skip("") def test_age_on_jupiter(self): age = SpaceAge(901876382) self.assertEqual(28.58, age.on_earth()) self.assertEqual(2.41, age.on_jupiter()) + @unittest.skip("") def test_age_on_saturn(self): age = SpaceAge(3e9) self.assertEqual(95.06, age.on_earth()) self.assertEqual(3.23, age.on_saturn()) + @unittest.skip("") def test_age_on_uranus(self): age = SpaceAge(3210123456) self.assertEqual(101.72, age.on_earth()) self.assertEqual(1.21, age.on_uranus()) + @unittest.skip("") def test_age_on_neptune(self): age = SpaceAge(8210123456) self.assertEqual(260.16, age.on_earth()) diff --git a/strain/strain_test.py b/strain/strain_test.py index b4757a734f..83cc95b034 100644 --- a/strain/strain_test.py +++ b/strain/strain_test.py @@ -7,35 +7,42 @@ class StrainTest(unittest.TestCase): def test_empty_sequence(self): self.assertEqual([], keep([], lambda x: x % 2 == 0)) + @unittest.skip("") def test_empty_keep(self): inp = [2, 4, 6, 8, 10] out = [] self.assertEqual(out, keep(inp, lambda x: x % 2 == 1)) + @unittest.skip("") def test_empty_discard(self): inp = [2, 4, 6, 8, 10] out = [] self.assertEqual(out, discard(inp, lambda x: x % 2 == 0)) + @unittest.skip("") def test_keep_everything(self): inp = [2, 4, 6, 8, 10] self.assertEqual(inp, keep(inp, lambda x: x % 2 == 0)) + @unittest.skip("") def test_discard_endswith(self): inp = ['dough', 'cash', 'plough', 'though', 'through', 'enough'] out = ['cash'] fn = lambda x: str.endswith(x, 'ough') self.assertEqual(out, discard(inp, fn)) + @unittest.skip("") def test_keep_z(self): inp = ['zebra', 'arizona', 'apple', 'google', 'mozilla'] out = ['zebra', 'arizona', 'mozilla'] self.assertEqual(out, keep(inp, lambda x: 'z' in x)) + @unittest.skip("") def test_keep_discard(self): inp = ['1,2,3', 'one', 'almost!', 'love'] self.assertEqual([], discard(keep(inp, str.isalpha), str.isalpha)) + @unittest.skip("") def test_keep_plus_discard(self): inp = ['1,2,3', 'one', 'almost!', 'love'] out = ['one', 'love', '1,2,3', 'almost!'] diff --git a/sublist/sublist_test.py b/sublist/sublist_test.py index a69569d9b1..3871e2bb4c 100644 --- a/sublist/sublist_test.py +++ b/sublist/sublist_test.py @@ -7,67 +7,81 @@ class SublistTest(unittest.TestCase): def test_empty_lists(self): self.assertEqual(EQUAL, check_lists([], [])) + @unittest.skip("") def test_empty_list_within(self): self.assertEqual(SUBLIST, check_lists([], [1, 2, 3])) + @unittest.skip("") def test_within_empty_list(self): self.assertEqual(SUPERLIST, check_lists([1], [])) + @unittest.skip("") def test_equal_lists(self): l1 = [0, 1, 2] l2 = [0, 1, 2] self.assertEqual(EQUAL, check_lists(l1, l2)) + @unittest.skip("") def test_different_lists(self): l1 = list(range(1000000)) l2 = list(range(1, 1000001)) self.assertEqual(UNEQUAL, check_lists(l1, l2)) + @unittest.skip("") def test_false_start(self): l1 = [1, 2, 5] l2 = [0, 1, 2, 3, 1, 2, 5, 6] self.assertEqual(SUBLIST, check_lists(l1, l2)) + @unittest.skip("") def test_consecutive(self): l1 = [1, 1, 2] l2 = [0, 1, 1, 1, 2, 1, 2] self.assertEqual(SUBLIST, check_lists(l1, l2)) + @unittest.skip("") def test_sublist_at_start(self): l1 = [0, 1, 2] l2 = [0, 1, 2, 3, 4, 5] self.assertEqual(SUBLIST, check_lists(l1, l2)) + @unittest.skip("") def test_sublist_in_middle(self): l1 = [2, 3, 4] l2 = [0, 1, 2, 3, 4, 5] self.assertEqual(SUBLIST, check_lists(l1, l2)) + @unittest.skip("") def test_sublist_at_end(self): l1 = [3, 4, 5] l2 = [0, 1, 2, 3, 4, 5] self.assertEqual(SUBLIST, check_lists(l1, l2)) + @unittest.skip("") def test_at_start_of_superlist(self): l1 = [0, 1, 2, 3, 4, 5] l2 = [0, 1, 2] self.assertEqual(SUPERLIST, check_lists(l1, l2)) + @unittest.skip("") def test_in_middle_of_superlist(self): l1 = [0, 1, 2, 3, 4, 5] l2 = [2, 3] self.assertEqual(SUPERLIST, check_lists(l1, l2)) + @unittest.skip("") def test_at_end_of_superlist(self): l1 = [0, 1, 2, 3, 4, 5] l2 = [3, 4, 5] self.assertEqual(SUPERLIST, check_lists(l1, l2)) + @unittest.skip("") def test_large_lists(self): l1 = list(range(1000))*1000 + list(range(1000, 1100)) l2 = list(range(900, 1050)) self.assertEqual(SUPERLIST, check_lists(l1, l2)) + @unittest.skip("") def test_spread_sublist(self): multiples_of_3 = list(range(3, 200, 3)) multiples_of_15 = list(range(15, 200, 15)) diff --git a/sum-of-multiples/sum_of_multiples_test.py b/sum-of-multiples/sum_of_multiples_test.py index ebe124ec7a..2ad291c269 100644 --- a/sum-of-multiples/sum_of_multiples_test.py +++ b/sum-of-multiples/sum_of_multiples_test.py @@ -17,24 +17,31 @@ class SumOfMultiplesTest(unittest.TestCase): def test_sum_to_1(self): self.assertEqual(0, sum_of_multiples(1)) + @unittest.skip("") def test_sum_to_3(self): self.assertEqual(3, sum_of_multiples(4)) + @unittest.skip("") def test_sum_to_10(self): self.assertEqual(23, sum_of_multiples(10)) + @unittest.skip("") def test_sum_to_1000(self): self.assertEqual(233168, sum_of_multiples(1000)) + @unittest.skip("") def test_configurable_7_13_17_to_20(self): self.assertEqual(51, sum_of_multiples(20, [7, 13, 17])) + @unittest.skip("") def test_configurable_43_47_to_10000(self): self.assertEqual(2203160, sum_of_multiples(10000, [43, 47])) + @unittest.skip("") def test_configurable_0_to_10(self): self.assertEqual(0, sum_of_multiples(10, [0])) + @unittest.skip("") def test_configurable_0_1_to_10(self): self.assertEqual(45, sum_of_multiples(10, [0, 1])) diff --git a/triangle/triangle_test.py b/triangle/triangle_test.py index af7ab6fcd3..e1e5f1c8b3 100644 --- a/triangle/triangle_test.py +++ b/triangle/triangle_test.py @@ -7,56 +7,69 @@ class TriangleTests(unittest.TestCase): def test_equilateral_triangles_have_equal_sides(self): self.assertEqual("equilateral", Triangle(2, 2, 2).kind()) + @unittest.skip("") def test_larger_equilateral_triangles_also_have_equal_sides(self): self.assertEqual("equilateral", Triangle(10, 10, 10).kind()) + @unittest.skip("") def test_isosceles_triangles_have_last_two_sides_equal(self): self.assertEqual("isosceles", Triangle(3, 4, 4).kind()) + @unittest.skip("") def test_isosceles_triangles_have_first_and_last_sides_equal(self): self.assertEqual("isosceles", Triangle(4, 3, 4).kind()) + @unittest.skip("") def test_isosceles_triangles_have_two_first_sides_equal(self): self.assertEqual("isosceles", Triangle(4, 4, 3).kind()) + @unittest.skip("") def test_isosceles_triangles_have_in_fact_exactly_two_sides_equal(self): self.assertEqual("isosceles", Triangle(10, 10, 2).kind()) + @unittest.skip("") def test_scalene_triangles_have_no_equal_sides(self): self.assertEqual("scalene", Triangle(3, 4, 5).kind()) + @unittest.skip("") def test_scalene_triangles_have_no_equal_sides_at_a_larger_scale_too(self): self.assertEqual("scalene", Triangle(10, 11, 12).kind()) self.assertEqual("scalene", Triangle(5, 4, 2).kind()) + @unittest.skip("") def test_very_small_triangles_are_legal(self): self.assertEqual("scalene", Triangle(0.4, 0.6, 0.3).kind()) + @unittest.skip("") def test_triangles_with_no_size_are_illegal(self): self.assertRaises( TriangleError, Triangle, 0, 0, 0 ) + @unittest.skip("") def test_triangles_with_negative_sides_are_illegal(self): self.assertRaises( TriangleError, Triangle, 3, 4, -5 ) + @unittest.skip("") def test_triangles_violating_triangle_inequality_are_illegal(self): self.assertRaises( TriangleError, Triangle, 1, 1, 3 ) + @unittest.skip("") def test_triangles_violating_triangle_inequality_are_illegal_2(self): self.assertRaises( TriangleError, Triangle, 2, 4, 2 ) + @unittest.skip("") def test_triangles_violating_triangle_inequality_are_illegal_3(self): self.assertRaises( TriangleError, diff --git a/trinary/trinary_test.py b/trinary/trinary_test.py index 1ba7f10d30..0028d6a73f 100644 --- a/trinary/trinary_test.py +++ b/trinary/trinary_test.py @@ -7,21 +7,27 @@ class TrinaryTest(unittest.TestCase): def test_valid_trinary1(self): self.assertEqual(0, trinary('0')) + @unittest.skip("") def test_valid_trinary2(self): self.assertEqual(1, trinary('1')) + @unittest.skip("") def test_valid_trinary3(self): self.assertEqual(3, trinary('10')) + @unittest.skip("") def test_valid_trinary4(self): self.assertEqual(307, trinary('102101')) + @unittest.skip("") def test_valid_trinary5(self): self.assertEqual(242, trinary('22222')) + @unittest.skip("") def test_valid_trinary6(self): self.assertEqual(81, trinary('10000')) + @unittest.skip("") def test_invalid_trinary(self): self.assertEqual(0, trinary('13201')) diff --git a/twelve-days/twelve_days_test.py b/twelve-days/twelve_days_test.py index d039968289..e1304782a1 100644 --- a/twelve-days/twelve_days_test.py +++ b/twelve-days/twelve_days_test.py @@ -9,50 +9,62 @@ def test_verse1(self): expected = "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(1)) + @unittest.skip("") def test_verse2(self): expected = "On the second day of Christmas my true love gave to me, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(2)) + @unittest.skip("") def test_verse3(self): expected = "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(3)) + @unittest.skip("") def test_verse4(self): expected = "On the fourth day of Christmas my true love gave to me, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(4)) + @unittest.skip("") def test_verse5(self): expected = "On the fifth day of Christmas my true love gave to me, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(5)) + @unittest.skip("") def test_verse6(self): expected = "On the sixth day of Christmas my true love gave to me, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(6)) + @unittest.skip("") def test_verse7(self): expected = "On the seventh day of Christmas my true love gave to me, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(7)) + @unittest.skip("") def test_verse8(self): expected = "On the eighth day of Christmas my true love gave to me, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(8)) + @unittest.skip("") def test_verse9(self): expected = "On the ninth day of Christmas my true love gave to me, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(9)) + @unittest.skip("") def test_verse10(self): expected = "On the tenth day of Christmas my true love gave to me, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(10)) + @unittest.skip("") def test_verse11(self): expected = "On the eleventh day of Christmas my true love gave to me, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(11)) + @unittest.skip("") def test_verse12(self): expected = "On the twelfth day of Christmas my true love gave to me, twelve Drummers Drumming, eleven Pipers Piping, ten Lords-a-Leaping, nine Ladies Dancing, eight Maids-a-Milking, seven Swans-a-Swimming, six Geese-a-Laying, five Gold Rings, four Calling Birds, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n" self.assertEqual(expected, verse(12)) + @unittest.skip("") def test_multiple_verses(self): expected = ( "On the first day of Christmas my true love gave to me, a Partridge in a Pear Tree.\n\n" + @@ -60,6 +72,7 @@ def test_multiple_verses(self): "On the third day of Christmas my true love gave to me, three French Hens, two Turtle Doves, and a Partridge in a Pear Tree.\n\n") self.assertEqual(expected, verses(1, 3)) + @unittest.skip("") def test_the_whole_song(self): self.assertEqual(verses(1, 12), sing()) diff --git a/word-count/word_count_test.py b/word-count/word_count_test.py index 009dc7757f..a8057cb28f 100644 --- a/word-count/word_count_test.py +++ b/word-count/word_count_test.py @@ -10,42 +10,49 @@ def test_count_one_word(self): word_count('word') ) + @unittest.skip("") def test_count_one_of_each(self): self.assertEqual( {'one': 1, 'of': 1, 'each': 1}, word_count('one of each') ) + @unittest.skip("") def test_count_multiple_occurences(self): self.assertEqual( {'one': 1, 'fish': 4, 'two': 1, 'red': 1, 'blue': 1}, word_count('one fish two fish red fish blue fish') ) + @unittest.skip("") def test_preserves_punctuation(self): self.assertEqual( {'car': 1, 'carpet': 1, 'as': 1, 'java': 1, ':': 2, 'javascript!!&@$%^&': 1}, word_count('car : carpet as java : javascript!!&@$%^&') ) + @unittest.skip("") def test_include_numbers(self): self.assertEqual( {'testing': 2, '1': 1, '2': 1}, word_count('testing 1 2 testing') ) + @unittest.skip("") def test_mixed_case(self): self.assertEqual( {'go': 1, 'Go': 1, 'GO': 1}, word_count('go Go GO') ) + @unittest.skip("") def test_multiple_spaces(self): self.assertEqual( {'wait': 1, 'for': 1, 'it': 1}, word_count('wait for it') ) + @unittest.skip("") def test_newlines(self): self.assertEqual( {'rah': 2, 'ah': 3, 'roma': 2, 'ma': 1, 'ga': 2, 'oh': 1, 'la': 2, diff --git a/wordy/wordy_test.py b/wordy/wordy_test.py index 778aecb2fc..1a0b301da6 100644 --- a/wordy/wordy_test.py +++ b/wordy/wordy_test.py @@ -9,56 +9,73 @@ class WordyTest(unittest.TestCase): def test_simple_add_1(self): self.assertEqual(18, calculate("What is 5 plus 13?")) + @unittest.skip("") def test_simple_add_2(self): self.assertEqual(-8, calculate("What is 5 plus -13?")) + @unittest.skip("") def test_simple_sub_1(self): self.assertEqual(6, calculate("What is 103 minus 97?")) + @unittest.skip("") def test_simple_sub_2(self): self.assertEqual(-6, calculate("What is 97 minus 103?")) + @unittest.skip("") def test_simple_mult(self): self.assertEqual(21, calculate("What is 7 multiplied by 3?")) + @unittest.skip("") def test_simple_div(self): self.assertEqual(9, calculate("What is 45 divided by 5?")) + @unittest.skip("") def test_add_negative_numbers(self): self.assertEqual(-11, calculate("What is -1 plus -10?")) + @unittest.skip("") def test_add_more_digits(self): self.assertEqual(45801, calculate("What is 123 plus 45678?")) + @unittest.skip("") def test_add_twice(self): self.assertEqual(4, calculate("What is 1 plus 2 plus 1?")) + @unittest.skip("") def test_add_then_subtract(self): self.assertEqual(14, calculate("What is 1 plus 5 minus -8?")) + @unittest.skip("") def test_subtract_twice(self): self.assertEqual(-7, calculate("What is 20 minus 14 minus 13?")) + @unittest.skip("") def test_multiply_twice(self): self.assertEqual(-12, calculate("What is 2 multiplied by -2 multiplied by 3?")) + @unittest.skip("") def test_add_then_multiply(self): self.assertEqual(-8, calculate("What is -3 plus 7 multiplied by -2?")) + @unittest.skip("") def test_divide_twice(self): self.assertEqual( 16, calculate("What is -12000 divided by 25 divided by -30?")) + @unittest.skip("") def test_invalid_operation(self): self.assertRaises(ValueError, calculate, "What is 4 xor 7?") + @unittest.skip("") def test_missing_operation(self): self.assertRaises(ValueError, calculate, "What is 2 2 minus 3?") + @unittest.skip("") def test_missing_number(self): self.assertRaises(ValueError, calculate, "What is 7 plus multiplied by -2?") + @unittest.skip("") def test_irrelevant_question(self): self.assertRaises(ValueError, calculate, "Which is greater, 3 or 2?") From d49caf14d1674fe84c8456d49a4247ebf10ab116 Mon Sep 17 00:00:00 2001 From: David Kinzer Date: Wed, 25 Mar 2015 16:27:10 -0400 Subject: [PATCH 2/3] Add test script. --- .travis.yml | 2 +- test/check-exercises.bash | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100755 test/check-exercises.bash diff --git a/.travis.yml b/.travis.yml index 6db64164fa..606f3b992b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ python: - "3.3" - "3.4" script: - - ./test/check-exercises.py + - ./test/check-exercises.bash - ./bin/fetch-configlet - ./bin/configlet . diff --git a/test/check-exercises.bash b/test/check-exercises.bash new file mode 100755 index 0000000000..3a6297e5f2 --- /dev/null +++ b/test/check-exercises.bash @@ -0,0 +1,32 @@ +#!/bin/bash + +#Run all tests including skipped ones. +for file in $(find . -name *_test.py); +do + dirname=$(dirname $file) + basename=$(basename $file) + + pushd $dirname > /dev/null + example_file=$(grep -o '^from.*import.*' $basename |cut -f2 -d' ' | tail -1) + if [[ -z $example_file ]] || [ __future__ == $example_file ] \ + || [ "unittest" == "$example_file" ] + then + example_file=$(echo $basename |cut -f1 -d'_') + fi + + if [ -f ${example_file}.py ] + then + cp ${example_file}.py ${example_file}.py.orig + fi + + cp example.py ${example_file}.py + sed '/@unittest.skip/d' $(basename $file) | python + rm ${example_file}.py + + if [ -f ${example_file}.py.orig ]; + then + cp ${example_file}.py.orig ${example_file}.py + rm ${example_file}.py.orig + fi + popd > /dev/null +done From 243445411cb819162ea32425b0d9907f3992b9e5 Mon Sep 17 00:00:00 2001 From: David Kinzer Date: Thu, 26 Mar 2015 05:53:25 -0400 Subject: [PATCH 3/3] Clean up testing script and rename files. By renaming modules to be imported to the follow the convention _test.py, we are able to simplify any script we write to automate testing. This commit modifies existing test to import modules that correspond to the convention _test.py and cleans up a previously generated script to automate the testing. --- beer-song/beer_song_test.py | 2 +- grade-school/grade_school_test.py | 2 +- ...ergarten_garden_test.py => garden_test.py} | 0 .../largest_series_product_test.py | 2 +- leap/leap_test.py | 2 +- nth-prime/nth_prime_test.py | 2 +- nucleotide-count/nucleotide_count_test.py | 2 +- .../palindrome_products_test.py | 2 +- phone-number/phone_number_test.py | 2 +- point-mutations/point_mutations_test.py | 2 +- rna-transcription/rna_transcription_test.py | 2 +- robot-name/robot_name_test.py | 2 +- .../{roman_numerals_test.py => roman_test.py} | 0 scrabble-score/scrabble_score_test.py | 2 +- simple-cipher/simple_cipher_test.py | 2 +- test/check-exercises.bash | 39 ++++++++++--------- word-count/word_count_test.py | 2 +- 17 files changed, 34 insertions(+), 33 deletions(-) rename kindergarten-garden/{kindergarten_garden_test.py => garden_test.py} (100%) rename roman-numerals/{roman_numerals_test.py => roman_test.py} (100%) diff --git a/beer-song/beer_song_test.py b/beer-song/beer_song_test.py index f838d8411f..c53850afe8 100644 --- a/beer-song/beer_song_test.py +++ b/beer-song/beer_song_test.py @@ -1,6 +1,6 @@ import unittest -from beer import song, verse +from beer_song import song, verse class BeerTest(unittest.TestCase): diff --git a/grade-school/grade_school_test.py b/grade-school/grade_school_test.py index c84a061dd1..f5e3d3bbe8 100644 --- a/grade-school/grade_school_test.py +++ b/grade-school/grade_school_test.py @@ -2,7 +2,7 @@ from types import GeneratorType import unittest -from school import School +from grade_school import School class SchoolTest(unittest.TestCase): diff --git a/kindergarten-garden/kindergarten_garden_test.py b/kindergarten-garden/garden_test.py similarity index 100% rename from kindergarten-garden/kindergarten_garden_test.py rename to kindergarten-garden/garden_test.py diff --git a/largest-series-product/largest_series_product_test.py b/largest-series-product/largest_series_product_test.py index af5495aad8..64a186abcf 100644 --- a/largest-series-product/largest_series_product_test.py +++ b/largest-series-product/largest_series_product_test.py @@ -8,7 +8,7 @@ """ import unittest -from series import largest_product, slices +from largest_series_product import largest_product, slices class SeriesTest(unittest.TestCase): diff --git a/leap/leap_test.py b/leap/leap_test.py index 01f1e26a38..08b1813e1f 100644 --- a/leap/leap_test.py +++ b/leap/leap_test.py @@ -1,6 +1,6 @@ import unittest -from year import is_leap_year +from leap import is_leap_year class YearTest(unittest.TestCase): diff --git a/nth-prime/nth_prime_test.py b/nth-prime/nth_prime_test.py index f22f0c336f..7643726c5b 100644 --- a/nth-prime/nth_prime_test.py +++ b/nth-prime/nth_prime_test.py @@ -1,6 +1,6 @@ import unittest -from prime import nth_prime +from nth_prime import nth_prime class NthPrimeTests(unittest.TestCase): diff --git a/nucleotide-count/nucleotide_count_test.py b/nucleotide-count/nucleotide_count_test.py index 3bcb863ff0..117ab3719d 100644 --- a/nucleotide-count/nucleotide_count_test.py +++ b/nucleotide-count/nucleotide_count_test.py @@ -6,7 +6,7 @@ """ import unittest -from dna import count, nucleotide_counts +from nucleotide_count import count, nucleotide_counts class DNATest(unittest.TestCase): diff --git a/palindrome-products/palindrome_products_test.py b/palindrome-products/palindrome_products_test.py index 7ce48a2fcc..c29a380695 100644 --- a/palindrome-products/palindrome_products_test.py +++ b/palindrome-products/palindrome_products_test.py @@ -13,7 +13,7 @@ import unittest -from palindrome import smallest_palindrome, largest_palindrome +from palindrome_products import smallest_palindrome, largest_palindrome class PalindromesTests(unittest.TestCase): diff --git a/phone-number/phone_number_test.py b/phone-number/phone_number_test.py index b908d39302..b78d6aa9f4 100644 --- a/phone-number/phone_number_test.py +++ b/phone-number/phone_number_test.py @@ -1,6 +1,6 @@ import unittest -from phone import Phone +from phone_number import Phone class PhoneTest(unittest.TestCase): diff --git a/point-mutations/point_mutations_test.py b/point-mutations/point_mutations_test.py index ac4c0569d5..be83c56d24 100644 --- a/point-mutations/point_mutations_test.py +++ b/point-mutations/point_mutations_test.py @@ -1,6 +1,6 @@ import unittest -from dna import hamming_distance +from point_mutations import hamming_distance class DNATest(unittest.TestCase): diff --git a/rna-transcription/rna_transcription_test.py b/rna-transcription/rna_transcription_test.py index 2f878af52f..78fc47e212 100644 --- a/rna-transcription/rna_transcription_test.py +++ b/rna-transcription/rna_transcription_test.py @@ -1,6 +1,6 @@ import unittest -from dna import to_rna +from rna_transcription import to_rna class DNATests(unittest.TestCase): diff --git a/robot-name/robot_name_test.py b/robot-name/robot_name_test.py index 33f834af20..0dabedfe37 100644 --- a/robot-name/robot_name_test.py +++ b/robot-name/robot_name_test.py @@ -1,6 +1,6 @@ import unittest -from robot import Robot +from robot_name import Robot import random diff --git a/roman-numerals/roman_numerals_test.py b/roman-numerals/roman_test.py similarity index 100% rename from roman-numerals/roman_numerals_test.py rename to roman-numerals/roman_test.py diff --git a/scrabble-score/scrabble_score_test.py b/scrabble-score/scrabble_score_test.py index 7eba48f0b4..9eb44be124 100644 --- a/scrabble-score/scrabble_score_test.py +++ b/scrabble-score/scrabble_score_test.py @@ -1,6 +1,6 @@ import unittest -from scrabble import score +from scrabble_score import score class WordTest(unittest.TestCase): diff --git a/simple-cipher/simple_cipher_test.py b/simple-cipher/simple_cipher_test.py index b4326cdc00..e659af7b8e 100644 --- a/simple-cipher/simple_cipher_test.py +++ b/simple-cipher/simple_cipher_test.py @@ -1,6 +1,6 @@ import unittest -from cipher import Caesar, Cipher +from simple_cipher import Caesar, Cipher class CipherTest(unittest.TestCase): diff --git a/test/check-exercises.bash b/test/check-exercises.bash index 3a6297e5f2..59b5123955 100755 --- a/test/check-exercises.bash +++ b/test/check-exercises.bash @@ -1,32 +1,33 @@ #!/bin/bash +# +# Runs all tests including skipped ones. +# +TEST_FILES=$(find . -name *_test.py) -#Run all tests including skipped ones. -for file in $(find . -name *_test.py); +for file in $TEST_FILES; do - dirname=$(dirname $file) - basename=$(basename $file) + EXERCISE_DIR=$(dirname $file) + TEST_FILE=$(basename $file) + EXAMPLE_FILE=$(echo $TEST_FILE | sed 's/_test//') - pushd $dirname > /dev/null - example_file=$(grep -o '^from.*import.*' $basename |cut -f2 -d' ' | tail -1) - if [[ -z $example_file ]] || [ __future__ == $example_file ] \ - || [ "unittest" == "$example_file" ] - then - example_file=$(echo $basename |cut -f1 -d'_') - fi + pushd $EXERCISE_DIR > /dev/null - if [ -f ${example_file}.py ] + # Protect Resources. + if [ -f $EXAMPLE_FILE ] then - cp ${example_file}.py ${example_file}.py.orig + mv $EXAMPLE_FILE ${EXAMPLE_FILE}.orig fi - cp example.py ${example_file}.py - sed '/@unittest.skip/d' $(basename $file) | python - rm ${example_file}.py + # Test. + cp example.py $EXAMPLE_FILE + sed '/@unittest.skip/d' $TEST_FILE | python + + # Cleanup. + rm $EXAMPLE_FILE - if [ -f ${example_file}.py.orig ]; + if [ -f ${EXAMPLE_FILE}.orig ]; then - cp ${example_file}.py.orig ${example_file}.py - rm ${example_file}.py.orig + mv ${EXAMPLE_FILE}.orig ${EXAMPLE_FILE} fi popd > /dev/null done diff --git a/word-count/word_count_test.py b/word-count/word_count_test.py index a8057cb28f..97d5e6047d 100644 --- a/word-count/word_count_test.py +++ b/word-count/word_count_test.py @@ -1,6 +1,6 @@ import unittest -from wordcount import word_count +from word_count import word_count class WordCountTests(unittest.TestCase):