From: Katy Huff Date: Sun, 13 Jan 2013 17:43:15 +0000 (-0600) Subject: changes value to type error X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=f16de9422294342a11b803f4451af5237777af97;p=swc-testing-nose.git changes value to type error --- diff --git a/python/testing/Readme.md b/python/testing/Readme.md index 12bb6c2..30afea6 100644 --- a/python/testing/Readme.md +++ b/python/testing/Readme.md @@ -72,8 +72,8 @@ def mean(numlist): try: total = sum(numlist) length = len(numlist) - except ValueError: - print "The number list was not a list of numbers." + except TypeError: + raise TypeError("The number list was not a list of numbers.") except: print "There was a problem evaluating the number list." return total/length @@ -87,8 +87,8 @@ def mean(numlist): try: total = sum(numlist) length = len(numlist) - except ValueError: - print "The number list was not a list of numbers." + except TypeError: + raise TypeError("The number list was not a list of numbers.") except: print "There was a problem evaluating the number list." return total/length @@ -112,8 +112,8 @@ def mean(numlist): try: total = sum(numlist) length = len(numlist) - except ValueError: - print "The number list was not a list of numbers." + except TypeError: + raise TypeError("The number list was not a list of numbers.") except: print "There was a problem evaluating the number list." return total/length diff --git a/python/testing/mean.py b/python/testing/mean.py index c04a0f1..887484d 100644 --- a/python/testing/mean.py +++ b/python/testing/mean.py @@ -2,8 +2,8 @@ def mean(numlist): try: total = sum(numlist) length = len(numlist) - except ValueError: - print "The number list was not a list of numbers." + except TypeError: + raise TypeError("The number list was not a list of numbers.") except: print "There was a problem evaluating the number list." return total/length