Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions python2/koans/about_decorating_with_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ def test_partial_that_wrappers_no_args(self):
"""
max = functools.partial(self.maximum)

self.assertEqual(__, max(7, 23))
self.assertEqual(__, max(10, -10))
self.assertEqual(23, max(7, 23))
self.assertEqual(10, max(10, -10))

def test_partial_that_wrappers_first_arg(self):
max0 = functools.partial(self.maximum, 0)

self.assertEqual(__, max0(-4))
self.assertEqual(__, max0(5))
self.assertEqual(0, max0(-4))
self.assertEqual(5, max0(5))

def test_partial_that_wrappers_all_args(self):
always99 = functools.partial(self.maximum, 99, 20)
always20 = functools.partial(self.maximum, 9, 20)

self.assertEqual(__, always99())
self.assertEqual(__, always20())
self.assertEqual(99, always99())
self.assertEqual(20, always20())

# ------------------------------------------------------------------

Expand Down Expand Up @@ -65,8 +65,8 @@ def test_decorator_with_no_arguments(self):
# To clarify: the decorator above the function has no arguments, even
# if the decorated function does

self.assertEqual(__, self.foo())
self.assertEqual(__, self.parrot('pieces of eight'))
self.assertEqual("foo, foo", self.foo())
self.assertEqual("PIECES OF EIGHT, PIECES OF EIGHT", self.parrot('pieces of eight'))

# ------------------------------------------------------------------

Expand All @@ -78,7 +78,7 @@ def test_what_a_decorator_is_doing_to_a_function(self):
#wrap the function with the decorator
self.sound_check = self.doubleit(self.sound_check)

self.assertEqual(__, self.sound_check())
self.assertEqual("Testing..., Testing...", self.sound_check())

# ------------------------------------------------------------------

Expand Down Expand Up @@ -110,11 +110,11 @@ def idler(self, num):
pass

def test_decorator_with_an_argument(self):
self.assertEqual(__, self.count_badly(2))
self.assertEqual(__, self.count_badly.__doc__)
self.assertEqual(5, self.count_badly(2))
self.assertEqual("Increments a value by one. Kind of.", self.count_badly.__doc__)

def test_documentor_which_already_has_a_docstring(self):
self.assertEqual(__, self.idler.__doc__)
self.assertEqual("Idler: Does nothing", self.idler.__doc__)

# ------------------------------------------------------------------

Expand All @@ -125,5 +125,5 @@ def homer(self):
return "D'oh"

def test_we_can_chain_decorators(self):
self.assertEqual(__, self.homer())
self.assertEqual(__, self.homer.__doc__)
self.assertEqual("D'oh, D'oh, D'oh, D'oh", self.homer())
self.assertEqual("DOH!", self.homer.__doc__)