Permalink
Browse files

P3K: Modified RuntimeError message args

  • Loading branch information...
1 parent 704b861 commit ad66a25f5a4c76be1f7690190d968fd25543290c @smoitra87 smoitra87 committed with GaelVaroquaux Mar 13, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 sklearn/feature_extraction/tests/test_text.py
@@ -263,7 +263,13 @@ def test_tfidf_no_smoothing():
with warnings.catch_warnings(record=True) as w:
tfidf = tr.fit_transform(X).toarray()
assert_equal(len(w), 1)
- assert_true("divide by zero encountered in divide" in w[0].message)
+ # For Python 3 compatibility
+ if hasattr(w[0].message,'args') :
+ assert_true("divide by zero encountered in divide" in\
+ w[0].message.args[0])
+ else :
+ assert_true("divide by zero encountered in divide" in\
+ w[0].message)
def test_sublinear_tf():

0 comments on commit ad66a25

Please sign in to comment.