Commits

Jason R. Coombs committed 6433f6a

Added another test to dictlib.ItemsAsAttributes and fixed the failing test case. ItemsAsAttribute dicts now provide a more expected response when no attribute exists.

  • Participants
  • Parent commits cb3de79

Comments (0)

Files changed (1)

File jaraco/util/dictlib.py

 	# but as you might expect, the mapping functionality is preserved.
 	>>> i['foo']
 	'bar'
+	
+	# A normal attribute error should be raised if an attribute is
+	#  requested that doesn't exist.
+	>>> i.missing
+	Traceback (most recent call last):
+	...
+	AttributeError: 'C' object has no attribute 'missing'
 	"""
 	def __getattr__(self, key):
 		try:
-			return super(ItemsAsAttributes, self).__getattr__(key)
-		except AttributeError:
+			return getattr(super(ItemsAsAttributes, self), key)
+		except AttributeError as e:
 			if key in self:
 				return self[key]
+			e.message = e.message.replace('super',
+				self.__class__.__name__, 1)
+			e.args = (e.message,)
 			raise
+