diff --git a/common/lib/capa/capa/tests/test_responsetypes.py b/common/lib/capa/capa/tests/test_responsetypes.py index 07d0cc62ae..02f87c7d9c 100644 --- a/common/lib/capa/capa/tests/test_responsetypes.py +++ b/common/lib/capa/capa/tests/test_responsetypes.py @@ -308,34 +308,6 @@ class ImageResponseTest(ResponseTest): # pylint: disable=missing-docstring class SymbolicResponseTest(ResponseTest): # pylint: disable=missing-docstring xml_factory_class = SymbolicResponseXMLFactory - def test_grade_single_input_correct(self): - problem = self.build_problem(math_display=True, expect="2*x+3*y") - - # Correct answers - correct_inputs = [ - ('2x+3y', textwrap.dedent(""" - """), - 'snuggletex_2x+3y.xml'), - - ('x+x+3y', textwrap.dedent(""" - """), - 'snuggletex_x+x+3y.xml'), - ] - - for (input_str, input_mathml, server_fixture) in correct_inputs: - print "Testing input: {0}".format(input_str) - server_resp = load_fixture(server_fixture) - self._assert_symbolic_grade( - problem, input_str, input_mathml, - 'correct', snuggletex_resp=server_resp - ) - def test_grade_single_input_incorrect(self): problem = self.build_problem(math_display=True, expect="2*x+3*y") @@ -352,23 +324,6 @@ class SymbolicResponseTest(ResponseTest): # pylint: disable=missing-docstring for (input_str, input_mathml) in incorrect_inputs: self._assert_symbolic_grade(problem, input_str, input_mathml, 'incorrect') - def test_complex_number_grade_correct(self): - problem = self.build_problem( - math_display=True, - expect="[[cos(theta),i*sin(theta)],[i*sin(theta),cos(theta)]]", - options=["matrix", "imaginary"] - ) - - correct_snuggletex = load_fixture('snuggletex_correct.html') - dynamath_input = load_fixture('dynamath_input.txt') - student_response = "cos(theta)*[[1,0],[0,1]] + i*sin(theta)*[[0,1],[1,0]]" - - self._assert_symbolic_grade( - problem, student_response, dynamath_input, - 'correct', - snuggletex_resp=correct_snuggletex - ) - def test_complex_number_grade_incorrect(self): problem = self.build_problem(math_display=True, diff --git a/common/lib/symmath/setup.py b/common/lib/symmath/setup.py index 113b809191..3bef0d78a6 100644 --- a/common/lib/symmath/setup.py +++ b/common/lib/symmath/setup.py @@ -2,7 +2,7 @@ from setuptools import setup setup( name="symmath", - version="0.1", + version="0.2", packages=["symmath"], install_requires=[ "sympy==0.7.1", diff --git a/common/lib/symmath/symmath/formula.py b/common/lib/symmath/symmath/formula.py index 9317582502..45d92a7190 100644 --- a/common/lib/symmath/symmath/formula.py +++ b/common/lib/symmath/symmath/formula.py @@ -21,7 +21,6 @@ import unicodedata from copy import deepcopy from xml.sax.saxutils import unescape -import requests import sympy from lxml import etree from sympy import latex, sympify @@ -428,10 +427,7 @@ class formula(object): return "Error! Cannot process pmathml" pmathml = etree.tostring(xml, pretty_print=True) self.the_pmathml = pmathml # pylint: disable=attribute-defined-outside-init - - # convert to cmathml - self.the_cmathml = self.GetContentMathML(self.asciimath, pmathml) - return self.the_cmathml + return self.the_pmathml cmathml = property(get_content_mathml, None, None, 'content MathML representation') @@ -586,35 +582,3 @@ class formula(object): raise Exception('[formula] unknown tag %s' % tag) sympy = property(make_sympy, None, None, 'sympy representation') - - def GetContentMathML(self, asciimath, mathml): # pylint: disable=invalid-name - """ - Handle requests to snuggletex API to convert the Ascii math to MathML - """ - url = 'https://math-xserver.mitx.mit.edu/snuggletex-webapp-1.2.2/ASCIIMathMLUpConversionDemo' - - payload = { - 'asciiMathInput': asciimath, - 'asciiMathML': mathml, - } - headers = { - 'User-Agent': "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13" - } - request = requests.post(url, data=payload, headers=headers, verify=False) - request.encoding = 'utf-8' - ret = request.text - - mode = 0 - cmathml = [] - for k in ret.split('\n'): - if 'conversion to Content MathML' in k: - mode = 1 - continue - if mode == 1: - if '