Permalink
Browse files

FIX: handle py3k exception API

  • Loading branch information...
1 parent 6a973dd commit 17e06cc38d40919d92ee9fd58d36e481503c89d6 @ogrisel ogrisel committed Dec 29, 2011
Showing with 6 additions and 1 deletion.
  1. +6 −1 sklearn/metrics/cluster/tests/test_supervised.py
@@ -30,7 +30,12 @@ def assert_raise_message(exception, message, callable, *args, **kwargs):
callable(*args, **kwargs)
raise AssertionError("Should have raised %r" % exception(message))
except exception as e:
- assert e.message == message
+ if hasattr(e, 'message'):
+ # python 2.x
+ assert e.message == message
+ else:
+ # python 3.x
+ assert e.args[0] == message
def test_error_messages_on_wrong_input():

0 comments on commit 17e06cc

Please sign in to comment.