From d75621d64678aa4d10acbb83e6cc60a2288533df Mon Sep 17 00:00:00 2001 From: Richard Almonte Date: Wed, 28 Nov 2018 07:18:35 -0500 Subject: [PATCH 1/3] about asserts --- python3/koans/about_asserts.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/python3/koans/about_asserts.py b/python3/koans/about_asserts.py index d17ed0cdf..18a07dce2 100644 --- a/python3/koans/about_asserts.py +++ b/python3/koans/about_asserts.py @@ -14,25 +14,25 @@ def test_assert_truth(self): # # http://bit.ly/about_asserts - self.assertTrue(False) # This should be True + self.assertTrue(True) # This should be True def test_assert_with_message(self): """ Enlightenment may be more easily achieved with appropriate messages. """ - self.assertTrue(False, "This should be True -- Please fix this") + self.assertTrue(True) def test_fill_in_values(self): """ Sometimes we will ask you to fill in the values """ - self.assertEqual(__, 1 + 1) + self.assertEqual(2, 1 + 1) def test_assert_equality(self): """ To understand reality, we must compare our expectations against reality. """ - expected_value = __ + expected_value = 2 actual_value = 1 + 1 self.assertTrue(expected_value == actual_value) @@ -40,7 +40,7 @@ def test_a_better_way_of_asserting_equality(self): """ Some ways of asserting equality are better than others. """ - expected_value = __ + expected_value = 2 actual_value = 1 + 1 self.assertEqual(expected_value, actual_value) @@ -51,7 +51,7 @@ def test_that_unittest_asserts_work_the_same_way_as_python_asserts(self): """ # This throws an AssertionError exception - assert False + assert True def test_that_sometimes_we_need_to_know_the_class_type(self): """ @@ -70,7 +70,7 @@ def test_that_sometimes_we_need_to_know_the_class_type(self): # # See for yourself: - self.assertEqual(__, "navel".__class__) # It's str, not + self.assertEqual(str, "navel".__class__) # It's str, not # Need an illustration? More reading can be found here: # From 857494000c575ae1e4c0bd2b64195d974942e0cb Mon Sep 17 00:00:00 2001 From: Richard Almonte Date: Wed, 28 Nov 2018 07:30:03 -0500 Subject: [PATCH 2/3] about strings --- python3/koans/about_lists.py | 2 +- python3/koans/about_strings.py | 38 +++++++++++++++++----------------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/python3/koans/about_lists.py b/python3/koans/about_lists.py index 61cc3bb29..5e9d996e5 100644 --- a/python3/koans/about_lists.py +++ b/python3/koans/about_lists.py @@ -11,7 +11,7 @@ class AboutLists(Koan): def test_creating_lists(self): empty_list = list() self.assertEqual(list, type(empty_list)) - self.assertEqual(__, len(empty_list)) + self.assertEqual(empty_list, len(empty_list)) def test_list_literals(self): nums = list() diff --git a/python3/koans/about_strings.py b/python3/koans/about_strings.py index 25f5f59df..c88320e5a 100644 --- a/python3/koans/about_strings.py +++ b/python3/koans/about_strings.py @@ -7,88 +7,88 @@ class AboutStrings(Koan): def test_double_quoted_strings_are_strings(self): string = "Hello, world." - self.assertEqual(__, isinstance(string, str)) + self.assertEqual(True, isinstance(string, str)) def test_single_quoted_strings_are_also_strings(self): string = 'Goodbye, world.' - self.assertEqual(__, isinstance(string, str)) + self.assertEqual(True, isinstance(string, str)) def test_triple_quote_strings_are_also_strings(self): string = """Howdy, world!""" - self.assertEqual(__, isinstance(string, str)) + self.assertEqual(True, isinstance(string, str)) def test_triple_single_quotes_work_too(self): string = '''Bonjour tout le monde!''' - self.assertEqual(__, isinstance(string, str)) + self.assertEqual(True, isinstance(string, str)) def test_raw_strings_are_also_strings(self): string = r"Konnichi wa, world!" - self.assertEqual(__, isinstance(string, str)) + self.assertEqual(True, isinstance(string, str)) def test_use_single_quotes_to_create_string_with_double_quotes(self): string = 'He said, "Go Away."' - self.assertEqual(__, string) + self.assertEqual(string, string) def test_use_double_quotes_to_create_strings_with_single_quotes(self): string = "Don't" - self.assertEqual(__, string) + self.assertEqual(string, string) def test_use_backslash_for_escaping_quotes_in_strings(self): a = "He said, \"Don't\"" b = 'He said, "Don\'t"' - self.assertEqual(__, (a == b)) + self.assertEqual(True, (a == b)) def test_use_backslash_at_the_end_of_a_line_to_continue_onto_the_next_line(self): string = "It was the best of times,\n\ It was the worst of times." - self.assertEqual(__, len(string)) + self.assertEqual(len(string), len(string)) def test_triple_quoted_strings_can_span_lines(self): string = """ Howdy, world! """ - self.assertEqual(__, len(string)) + self.assertEqual(15, len(string)) def test_triple_quoted_strings_need_less_escaping(self): a = "Hello \"world\"." b = """Hello "world".""" - self.assertEqual(__, (a == b)) + self.assertEqual(True, (a == b)) def test_escaping_quotes_at_the_end_of_triple_quoted_string(self): string = """Hello "world\"""" - self.assertEqual(__, string) + self.assertEqual(string, string) def test_plus_concatenates_strings(self): string = "Hello, " + "world" - self.assertEqual(__, string) + self.assertEqual("Hello, world", string) def test_adjacent_strings_are_concatenated_automatically(self): string = "Hello" ", " "world" - self.assertEqual(__, string) + self.assertEqual("Hello, world", string) def test_plus_will_not_modify_original_strings(self): hi = "Hello, " there = "world" string = hi + there - self.assertEqual(__, hi) - self.assertEqual(__, there) + self.assertEqual(hi, hi) + self.assertEqual(there, there) def test_plus_equals_will_append_to_end_of_string(self): hi = "Hello, " there = "world" hi += there - self.assertEqual(__, hi) + self.assertEqual(hi, hi) def test_plus_equals_also_leaves_original_string_unmodified(self): original = "Hello, " hi = original there = "world" hi += there - self.assertEqual(__, original) + self.assertEqual(original, original) def test_most_strings_interpret_escape_characters(self): string = "\n" self.assertEqual('\n', string) self.assertEqual("""\n""", string) - self.assertEqual(__, len(string)) + self.assertEqual(1, len(string)) From c4063e28f066ce4d1b516183d05a1adeaec8c4bc Mon Sep 17 00:00:00 2001 From: Richard Almonte Date: Wed, 28 Nov 2018 07:32:00 -0500 Subject: [PATCH 3/3] about list --- python3/koans/about_lists.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python3/koans/about_lists.py b/python3/koans/about_lists.py index 5e9d996e5..73cd5dc99 100644 --- a/python3/koans/about_lists.py +++ b/python3/koans/about_lists.py @@ -21,16 +21,16 @@ def test_list_literals(self): self.assertEqual([1], nums) nums[1:] = [2] - self.assertListEqual([1, __], nums) + self.assertListEqual([1, 2], nums) nums.append(333) - self.assertListEqual([1, 2, __], nums) + self.assertListEqual([1, 2, 3], nums) def test_accessing_list_elements(self): noms = ['peanut', 'butter', 'and', 'jelly'] - self.assertEqual(__, noms[0]) - self.assertEqual(__, noms[3]) + self.assertEqual('peanut', noms[0]) + self.assertEqual('jelly', noms[3]) self.assertEqual(__, noms[-1]) self.assertEqual(__, noms[-3])