Skip to content

Commit

Permalink
Uncomment interesting test to consider soon
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainDe committed Apr 2, 2015
1 parent 5016b84 commit 6f32813
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions didyoumean/didyoumean_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def runs(self, code, version_range=ALL_VERSIONS):
if version_in_range(version_range):
exec(code)

def throws(self, code, error_info, sugg=None, version_range=ALL_VERSIONS):
def throws(self, code, error_info,
sugg=None, version_range=ALL_VERSIONS, check_re=True):
"""Helper function to run code and check it throws."""
if version_in_range(version_range):
error_type, error_msg = error_info
Expand All @@ -108,7 +109,8 @@ def throws(self, code, error_info, sugg=None, version_range=ALL_VERSIONS):
except:
type_caught, value, traceback = sys.exc_info()
self.assertTrue(issubclass(error_type, type_caught))
self.assertRegexpMatches(''.join(value.args[0]), error_msg)
if check_re:
self.assertRegexpMatches(''.join(value.args[0]), error_msg)
if sugg is None:
sugg = []
if not isinstance(sugg, list):
Expand Down Expand Up @@ -436,12 +438,8 @@ def test_from_class2(self):
"""Should be 'this_is_cls_mthd'."""
code = 'FoobarClass.{0}()'
typo, sugg = 'this_is_cls_mth', 'this_is_cls_mthd'
_, good_code = format_str(code, typo, sugg)
# FIXME
# self.throws(
# bad_code,
# ATTRIBUTEERROR,
# ". Did you mean '" + sugg + "'\?")
bad_code, good_code = format_str(code, typo, sugg)
self.throws(bad_code, ATTRIBUTEERROR, [], check_re=False) # FIXME
self.runs(good_code)

def test_removed_has_key(self):
Expand Down

0 comments on commit 6f32813

Please sign in to comment.