Skip to content

Commit dce689c

Browse files
committed
Reinstated __class__.__name in a number of AboutNewStyleClasses tests
1 parent 41f52e7 commit dce689c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

python2/koans/about_new_style_classes.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,16 @@ def test_new_style_classes_have_more_attributes(self):
3434
# ------------------------------------------------------------------
3535

3636
def test_old_style_classes_have_type_but_no_class_attribute(self):
37-
self.assertEqual(__, self.OldStyleClass.__class__)
37+
# Note: The .__name__ attribute will convert the type into a string
38+
# value.
39+
#self.assertEqual(__, type(self.OldStyleClass).__name__)
3840

3941
try:
40-
cls = self.OldStyleClass.__class__
42+
cls = self.OldStyleClass.__class__.__name__
4143
except Exception as ex:
4244
pass
4345

44-
#
45-
# Let's look at the error message we get when trying to invoke
46-
# __class__ on an old style class object
47-
#
46+
# What was that error message from the exception?
4847
self.assertMatch(__, ex[0])
4948

5049
def test_new_style_classes_have_same_class_as_type(self):
@@ -58,9 +57,10 @@ def test_new_style_classes_have_same_class_as_type(self):
5857

5958
def test_in_old_style_instances_class_is_different_to_type(self):
6059
old_style = self.OldStyleClass()
61-
self.assertEqual(__, old_style.__class__)
60+
self.assertEqual(__, old_style.__class__.__name__)
61+
self.assertEqual(__, type(old_style).__name__)
6262

6363
def test_new_style_instances_have_same_class_as_type(self):
6464
new_style = self.NewStyleClass()
65-
self.assertEqual(__, new_style.__class__)
65+
self.assertEqual(__, new_style.__class__.__name__)
6666
self.assertEqual(__, type(new_style) == new_style.__class__)

0 commit comments

Comments
 (0)