Пример #1
0
 def test_vertial_input_is_delimiter_opening(self):
     data = EquationData(r"""\[\int_{a}^{b}{x^2}{\delta x}\]""")
     mathNode = data.findMathNode()
     stack = []
     nextNode = data.getNodeAt(mathNode, 0)
     res, remaining = data.buildNode(nextNode, None, None, None)
     nextNode = data.getNodeAt(mathNode, 1)
     node, remaining = data.buildNode(nextNode, None, None, None)
     data.addToStack(stack, res, node)
     self.assertFalse(node.isOpeningDelimeter(),
                      "latex vertical is an opening delimeter")
Пример #2
0
 def test_LeftParanMacro(self):
     data = EquationData(r"""\[\lparen\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 0)
     res, _ = data.buildNode(nextNode)
     self.assertIsNotNone(res, "Build node should return a node")
     self.assertEqual(res.getTokenType(), TokenType.T_LPAR)
Пример #3
0
 def test_delta(self):
     data = EquationData(r"""\[\delta\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 0)
     res, _ = data.buildNode(nextNode)
     self.assertIsNotNone(res, "Build node should return a node")
     self.assertEqual(res.getTokenType(), TokenType.T_DELTA)
Пример #4
0
 def test_power_with_func(self):
     data = EquationData(r"""\[{a}^{b}\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 1)
     res, _ = data.buildNode(nextNode)
     self.assertIsNotNone(res, "Build node should return a node")
     self.assertEqual(res.getTokenType(), TokenType.T_POWER)
Пример #5
0
 def test_GROUP_with_func(self):
     data = EquationData(r"""\[\int_{a}^{b}{x^2}{\delta x}\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 2)
     res, _ = data.buildNode(nextNode)
     self.assertIsNotNone(res, "Build node should return a node")
     self.assertEqual(res.getTokenType(), TokenType.T_VARIABLE)
Пример #6
0
 def test_vertial_input_is_closing(self):
     data = EquationData(r"""\[\int_{a+1}^{b}{{x+1}^{2c}}{\delta x}\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 1)
     res, remaining = data.buildNode(nextNode, None, None, None)
     self.assertEqual(res.getTokenType(), TokenType.S_VERTICAL)
     self.assertFalse(res.isClosing())
Пример #7
0
 def test_integral_is_not_closing_empty(self):
     data = EquationData(r"""\[\int_{a+1}^{b}{{x+1}^{2c}}{\delta x}\]""")
     # \int_{a+1}^{b}{{x+1}^{2c}+x^{2c}}{\delta x}
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 0)
     res, remaining = data.buildNode(nextNode, None, None, None)
     self.assertFalse(res.isClosing())
Пример #8
0
 def test_integral_is_delimiter(self):
     data = EquationData(r"""\[\int_{a}^{b}{x^2}{\delta x}\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 0)
     res, remaining = data.buildNode(nextNode, None, None, None)
     self.assertFalse(res.isDelimiter(),
                      "an integral is not a delimiter in an empty stack")
Пример #9
0
 def test_if_integral_is_full(self):
     data = EquationData(r"""\[\int_{a}^{b}{x^2}{\delta x}\]""")
     mathNode = data.findMathNode()
     stack = []
     nextNode = data.getNodeAt(mathNode, 0)
     res, remaining = data.buildNode(nextNode, None, None, None)
     self.assertFalse(res.isClosing(),
                      "latex vertical is an opening delimeter")
Пример #10
0
 def test_avaraible_returns(self):
     data = EquationData(r"""\[a\]""")
     mathNode = data.findMathNode()
     nextNode = data.getNodeAt(mathNode, 0)
     res, _ = data.buildNode(nextNode, None, None, None)
     self.assertEqual(res.getTokenType(), TokenType.T_VARIABLE)
     self.assertTrue(res.isClosing())
     self.assertFalse(res.lookAhead())
     self.assertFalse(res.lookBehind())