def test_compile_EvalNot(self): c_not = qc.EvalNot(qc.EvalConstant(17)) self.assertEqual(bool, c_not.dtype)
def test_expr_constant(self): self.assertEqual(qc.EvalConstant(D(17)), qc.compile_expression(qp.Constant(D(17)), qe.TargetsEnvironment()))
def test_print_from(self): self.assertCompile(qc.EvalPrint( qc.EvalFrom(qc.EvalEqual(qe.YearEntryColumn(), qc.EvalConstant(2014)), None, None, None) ), "PRINT FROM year = 2014;")
def test_compile_EvalOr(self): c_or = qc.EvalOr(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(bool, c_or.dtype)
def test_compile_EvalSub(self): c_plus = qc.EvalSub(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(Decimal, c_plus.dtype)
def test_compile_EvalMatch(self): with self.assertRaises(qc.CompilationError): qc.EvalMatch(qc.EvalConstant('testing'), qc.EvalConstant(18)) c_equal = qc.EvalMatch(qc.EvalConstant('testing'), qc.EvalConstant('test.*')) self.assertEqual(bool, c_equal.dtype)
def test_compile_EvalAnd(self): c_and = qc.EvalAnd(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(bool, c_and.dtype)
def test_compile_EvalGreaterEq(self): c_ge = qc.EvalGreaterEq(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(bool, c_ge.dtype)
def test_compile_EvalLessEq(self): c_le = qc.EvalLessEq(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(bool, c_le.dtype)
def test_compile_EvalEqual(self): c_equal = qc.EvalEqual(qc.EvalConstant(17), qc.EvalConstant(18)) self.assertEqual(bool, c_equal.dtype)
def test_compile_EvalLast(self): c_last = qe.Last([qc.EvalConstant(17.)]) self.assertEqual(float, c_last.dtype)
def test_compile_EvalCount(self): c_count = qe.Count([qc.EvalConstant(17)]) self.assertEqual(int, c_count.dtype)
def test_compile_EvalDay(self): with self.assertRaises(qc.CompilationError): qe.Day([qc.EvalConstant(17)]) c_day = qe.Day([qc.EvalConstant(datetime.date.today())]) self.assertEqual(int, c_day.dtype)
def test_compile_EvalLength(self): with self.assertRaises(qc.CompilationError): qe.Length([qc.EvalConstant(17)]) c_length = qe.Length([qc.EvalConstant('testing')]) self.assertEqual(int, c_length.dtype)