Commit 7bc92d3d by Vik Paruchuri

add tests compatible with nose

parent 6f7ae1c2
<b><fg>In order to replicate this experiment, I would need to know additional information such as the four different samples that they used (because I could have choosen metal, carbboard&&&&&and many other sample materials that they&;;;& didn't use and would get different results. Also I would also<>>> need to know the amount of vinegar to pour because this can caute a major change. Lastly, they might want to tell//////where to sit the samples while they dry for 30 minutes because if they are sitting in room temp. or by a light source makes a difference too.<b><b>
In order to replicate this experiment, I would need to know additional information such as the four different samples that they used (because I could have choosen metal, carbboard and many other sample materials that they didn't use and would get different results. Also I would also need to know the amount of vinegar to pour because this can caute a major change. Lastly, they might want to tell where to sit the samples while they dry for 30 minutes because if they are sitting in room temp. or by a light source makes a difference too.
{"grader":"models/essay_set_1.p"}
In order to conduct the experiment, the students would need to know the mass of the marble, the height of the drop, and the air temperature.
this is an incorrect response
......@@ -44,16 +44,22 @@ def send(payload, answer):
def check_contains(string, substr):
if not substr in string:
print "ERROR: Expected '{0}' in '{1}'".format(substr, string)
return False
else:
return True
def check_not_contains(string, substr):
if substr in string:
print "ERROR: Expected '{0}' not to be in '{1}'".format(substr, string)
return False
else:
return True
def check_right(string):
check_contains(string, '\"correct\": true')
return check_contains(string, '\"correct\": true')
def check_wrong(string):
check_contains(string, '\"correct\": false')
return check_contains(string, '\"correct\": false')
def globs(dirname, *patterns):
"""
......@@ -91,12 +97,23 @@ def check(dirname):
for name in globs(dirname, 'answer*.txt', 'right*.py'):
print "Checking correct response from {0}".format(name)
answer = contents(name)
check_right(send(payload, answer))
right=check_right(send(payload, answer))
for name in globs(dirname, 'wrong*.txt'):
print "Checking wrong response from {0}".format(name)
answer = contents(name)
check_wrong(send(payload, answer))
wrong=check_wrong(send(payload, answer))
assert wrong and right
def test():
#root = args.root or '.'
root=os.path.dirname( os.path.abspath(__file__ ))
for dirpath, _, _ in os.walk(root):
print("checking" + dirpath)
yield check, dirpath
def main(argv):
global xserver
......
__author__ = 'vik'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment