Skip to content

Commit 9260560

Browse files
committed
working
1 parent 9a18f80 commit 9260560

2 files changed

Lines changed: 26 additions & 26 deletions

File tree

python2/koans/about_asserts.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,34 +15,34 @@ def test_assert_truth(self):
1515
#
1616
# http://bit.ly/about_asserts
1717

18-
self.assertTrue(False) # This should be true
18+
self.assertTrue(True) # This should be true
1919

2020
def test_assert_with_message(self):
2121
"""
2222
Enlightenment may be more easily achieved with appropriate messages.
2323
"""
24-
self.assertTrue(False, "This should be true -- Please fix this")
24+
self.assertTrue(True, "This should be true -- Please fix this")
2525

2626
def test_fill_in_values(self):
2727
"""
2828
Sometimes we will ask you to fill in the values
2929
"""
30-
self.assertEqual(__, 1 + 1)
30+
self.assertEqual(2, 1 + 1)
3131

3232
def test_assert_equality(self):
3333
"""
3434
To understand reality, we must compare our expectations against
3535
reality.
3636
"""
37-
expected_value = __
37+
expected_value = 2
3838
actual_value = 1 + 1
3939
self.assertTrue(expected_value == actual_value)
4040

4141
def test_a_better_way_of_asserting_equality(self):
4242
"""
4343
Some ways of asserting equality are better than others.
4444
"""
45-
expected_value = __
45+
expected_value = 2
4646
actual_value = 1 + 1
4747

4848
self.assertEqual(expected_value, actual_value)
@@ -53,7 +53,7 @@ def test_that_unittest_asserts_work_the_same_way_as_python_asserts(self):
5353
"""
5454

5555
# This throws an AssertionError exception
56-
assert False
56+
assert True
5757

5858
def test_that_sometimes_we_need_to_know_the_class_type(self):
5959
"""
@@ -72,7 +72,7 @@ def test_that_sometimes_we_need_to_know_the_class_type(self):
7272
#
7373
# See for yourself:
7474

75-
self.assertEqual(__, "naval".__class__) # It's str, not <type 'str'>
75+
self.assertEqual(str, "naval".__class__) # It's str, not <type 'str'>
7676

7777
# Need an illustration? More reading can be found here:
7878
#

python2/koans/about_strings.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,88 +8,88 @@ class AboutStrings(Koan):
88

99
def test_double_quoted_strings_are_strings(self):
1010
string = "Hello, world."
11-
self.assertEqual(__, isinstance(string, basestring))
11+
self.assertEqual(True, isinstance(string, basestring))
1212

1313
def test_single_quoted_strings_are_also_strings(self):
1414
string = 'Goodbye, world.'
15-
self.assertEqual(__, isinstance(string, basestring))
15+
self.assertEqual(True, isinstance(string, basestring))
1616

1717
def test_triple_quote_strings_are_also_strings(self):
1818
string = """Howdy, world!"""
19-
self.assertEqual(__, isinstance(string, basestring))
19+
self.assertEqual(True, isinstance(string, basestring))
2020

2121
def test_triple_single_quotes_work_too(self):
2222
string = '''Bonjour tout le monde!'''
23-
self.assertEqual(__, isinstance(string, basestring))
23+
self.assertEqual(True, isinstance(string, basestring))
2424

2525
def test_raw_strings_are_also_strings(self):
2626
string = r"Konnichi wa, world!"
27-
self.assertEqual(__, isinstance(string, basestring))
27+
self.assertEqual(True, isinstance(string, basestring))
2828

2929
def test_use_single_quotes_to_create_string_with_double_quotes(self):
3030
string = 'He said, "Go Away."'
31-
self.assertEqual(__, string)
31+
self.assertEqual('He said, "Go Away."', string)
3232

3333
def test_use_double_quotes_to_create_strings_with_single_quotes(self):
3434
string = "Don't"
35-
self.assertEqual(__, string)
35+
self.assertEqual("Don't", string)
3636

3737
def test_use_backslash_for_escaping_quotes_in_strings(self):
3838
a = "He said, \"Don't\""
3939
b = 'He said, "Don\'t"'
40-
self.assertEqual(__, (a == b))
40+
self.assertEqual(True, (a == b))
4141

4242
def test_use_backslash_at_the_end_of_a_line_to_continue_onto_the_next_line(self):
4343
string = "It was the best of times,\n\
4444
It was the worst of times."
45-
self.assertEqual(__, len(string))
45+
self.assertEqual(52, len(string))
4646

4747
def test_triple_quoted_strings_can_span_lines(self):
4848
string = """
4949
Howdy,
5050
world!
5151
"""
52-
self.assertEqual(__, len(string))
52+
self.assertEqual(15, len(string))
5353

5454
def test_triple_quoted_strings_need_less_escaping(self):
5555
a = "Hello \"world\"."
5656
b = """Hello "world"."""
57-
self.assertEqual(__, (a == b))
57+
self.assertEqual(True, (a == b))
5858

5959
def test_escaping_quotes_at_the_end_of_triple_quoted_string(self):
6060
string = """Hello "world\""""
61-
self.assertEqual(__, string)
61+
self.assertEqual('Hello "world"', string)
6262

6363
def test_plus_concatenates_strings(self):
6464
string = "Hello, " + "world"
65-
self.assertEqual(__, string)
65+
self.assertEqual("Hello, world", string)
6666

6767
def test_adjacent_strings_are_concatenated_automatically(self):
6868
string = "Hello" ", " "world"
69-
self.assertEqual(__, string)
69+
self.assertEqual("Hello, world", string)
7070

7171
def test_plus_will_not_modify_original_strings(self):
7272
hi = "Hello, "
7373
there = "world"
7474
string = hi + there
75-
self.assertEqual(__, hi)
76-
self.assertEqual(__, there)
75+
self.assertEqual("Hello, ", hi)
76+
self.assertEqual("world", there)
7777

7878
def test_plus_equals_will_append_to_end_of_string(self):
7979
hi = "Hello, "
8080
there = "world"
8181
hi += there
82-
self.assertEqual(__, hi)
82+
self.assertEqual("Hello, world", hi)
8383

8484
def test_plus_equals_also_leaves_original_string_unmodified(self):
8585
original = "Hello, "
8686
hi = original
8787
there = "world"
8888
hi += there
89-
self.assertEqual(__, original)
89+
self.assertEqual("Hello, ", original)
9090

9191
def test_most_strings_interpret_escape_characters(self):
9292
string = "\n"
9393
self.assertEqual('\n', string)
9494
self.assertEqual("""\n""", string)
95-
self.assertEqual(__, len(string))
95+
self.assertEqual(1, len(string))

0 commit comments

Comments
 (0)