Skip to content

Commit

Permalink
Warn if float match doesn't have either rtol or atol
Browse files Browse the repository at this point in the history
  • Loading branch information
inducer committed Aug 11, 2015
1 parent 387426b commit 52ae311
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions course/page/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,14 @@ def __init__(self, vctx, location, matcher_desc):
),
)

This comment has been minimized.

Copy link
@dzhuang

dzhuang Aug 11, 2015

Contributor

missing ``if vctx is not None:`

BTW, will there be warning messages in Sandbox mode?

This comment has been minimized.

Copy link
@inducer

inducer Aug 11, 2015

Author Owner

missing if vctx is not None:

Fixed as of 13fbc71.

BTW, will there be warning messages in Sandbox mode?

Yes, as of c690841.

if (
not hasattr(matcher_desc, "atol")
and
not hasattr(matcher_desc, "rtol")):
vctx.add_warning(location,
_("Float match should have either rtol or atol--"
"otherwise it will match any number"))

def validate(self, s):
try:
float(s)
Expand Down

0 comments on commit 52ae311

Please sign in to comment.