Skip to content

Commit e8160d6

Browse files
author
root
committed
lesson 1 complete.
1 parent 34f8cdc commit e8160d6

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

python2/koans/about_asserts.py

Lines changed: 8 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,8 @@ 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+
self.assertFalse(False)
57+
#self.assertEqual(self.assertFalse(False), assert False)
5758

5859
def test_that_sometimes_we_need_to_know_the_class_type(self):
5960
"""
@@ -72,7 +73,7 @@ def test_that_sometimes_we_need_to_know_the_class_type(self):
7273
#
7374
# See for yourself:
7475

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

7778
# Need an illustration? More reading can be found here:
7879
#

0 commit comments

Comments
 (0)