##// END OF EJS Templates
Merge pull request #3377 from minrk/nonemod...
Min RK -
r10810:1fc84b32 merge
parent child Browse files
Show More
@@ -638,10 +638,10 def _re_pattern_pprint(obj, p, cycle):
638 638
639 639 def _type_pprint(obj, p, cycle):
640 640 """The pprint for classes and types."""
641 try:
642 mod = obj.__module__
643 except AttributeError:
644 # Heap allocated types might not have the module attribute.
641 mod = getattr(obj, '__module__', None)
642 if mod is None:
643 # Heap allocated types might not have the module attribute,
644 # and others may set it to None.
645 645 return p.text(obj.__name__)
646 646
647 647 if mod in ('__builtin__', 'exceptions'):
@@ -53,6 +53,11 class Dummy1(object):
53 53 class Dummy2(Dummy1):
54 54 _repr_pretty_ = None
55 55
56 class NoModule(object):
57 pass
58
59 NoModule.__module__ = None
60
56 61
57 62 def test_indentation():
58 63 """Test correct indentation in groups"""
@@ -106,3 +111,10 def test_pprint_heap_allocated_type():
106 111 import xxlimited
107 112 output = pretty.pretty(xxlimited.Null)
108 113 nt.assert_equal(output, 'xxlimited.Null')
114
115 def test_pprint_nomod():
116 """
117 Test that pprint works for classes with no __module__.
118 """
119 output = pretty.pretty(NoModule)
120 nt.assert_equal(output, 'NoModule')
General Comments 0
You need to be logged in to leave comments. Login now