You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.1 KiB
81 lines
3.1 KiB
From d3f418e5f469be66f8e974e5b53487bd8698dea4 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Date: Wed, 16 Aug 2023 17:23:41 +0200
|
|
Subject: [PATCH 4/7] Revert "Adding tests for `validate` and noticed that
|
|
`re_evaluate` tests using `local_dict` argument are flawed and do not
|
|
actually work"
|
|
|
|
This reverts commit 74d597398ba3c379c196e469d40f516de110eaa5.
|
|
---
|
|
numexpr/__init__.py | 3 +--
|
|
numexpr/tests/test_numexpr.py | 32 ++------------------------------
|
|
2 files changed, 3 insertions(+), 32 deletions(-)
|
|
|
|
diff --git a/numexpr/__init__.py b/numexpr/__init__.py
|
|
index 7946f8522d..9cabe69589 100644
|
|
--- a/numexpr/__init__.py
|
|
+++ b/numexpr/__init__.py
|
|
@@ -31,8 +31,7 @@ is_cpu_amd_intel = False # DEPRECATION WARNING: WILL BE REMOVED IN FUTURE RELEAS
|
|
import os, os.path
|
|
import platform
|
|
from numexpr.expressions import E
|
|
-from numexpr.necompiler import (NumExpr, disassemble, evaluate, re_evaluate,
|
|
- validate)
|
|
+from numexpr.necompiler import NumExpr, disassemble, evaluate, re_evaluate
|
|
|
|
from numexpr.utils import (_init_num_threads,
|
|
get_vml_version, set_vml_accuracy_mode, set_vml_num_threads,
|
|
diff --git a/numexpr/tests/test_numexpr.py b/numexpr/tests/test_numexpr.py
|
|
index ccb0b6cb07..32f5be4b75 100644
|
|
--- a/numexpr/tests/test_numexpr.py
|
|
+++ b/numexpr/tests/test_numexpr.py
|
|
@@ -31,7 +31,7 @@ from numpy.testing import (assert_equal, assert_array_equal,
|
|
from numpy import shape, allclose, array_equal, ravel, isnan, isinf
|
|
|
|
import numexpr
|
|
-from numexpr import E, NumExpr, evaluate, re_evaluate, validate, disassemble, use_vml
|
|
+from numexpr import E, NumExpr, evaluate, re_evaluate, disassemble, use_vml
|
|
from numexpr.expressions import ConstantNode
|
|
|
|
import unittest
|
|
@@ -370,38 +370,10 @@ class test_evaluate(TestCase):
|
|
assert_array_equal(x, array([86., 124., 168.]))
|
|
|
|
def test_re_evaluate_dict(self):
|
|
- a1 = array([1., 2., 3.])
|
|
- b1 = array([4., 5., 6.])
|
|
- c1 = array([7., 8., 9.])
|
|
- x = evaluate("2*a + 3*b*c", local_dict={'a': a1, 'b': b1, 'c': c1})
|
|
- x = re_evaluate()
|
|
- assert_array_equal(x, array([86., 124., 168.]))
|
|
-
|
|
- def test_validate(self):
|
|
a = array([1., 2., 3.])
|
|
b = array([4., 5., 6.])
|
|
c = array([7., 8., 9.])
|
|
- retval = validate("2*a + 3*b*c")
|
|
- assert(retval is None)
|
|
- x = re_evaluate()
|
|
- assert_array_equal(x, array([86., 124., 168.]))
|
|
-
|
|
- def test_validate_missing_var(self):
|
|
- a = array([1., 2., 3.])
|
|
- b = array([4., 5., 6.])
|
|
- retval = validate("2*a + 3*b*c")
|
|
- assert(isinstance(retval, KeyError))
|
|
-
|
|
- def test_validate_syntax(self):
|
|
- retval = validate("2+")
|
|
- assert(isinstance(retval, SyntaxError))
|
|
-
|
|
- def test_validate_dict(self):
|
|
- a1 = array([1., 2., 3.])
|
|
- b1 = array([4., 5., 6.])
|
|
- c1 = array([7., 8., 9.])
|
|
- retval = validate("2*a + 3*b*c", local_dict={'a': a1, 'b': b1, 'c': c1})
|
|
- assert(retval is None)
|
|
+ x = evaluate("2*a + 3*b*c", local_dict={'a': a, 'b': b, 'c': c})
|
|
x = re_evaluate()
|
|
assert_array_equal(x, array([86., 124., 168.]))
|
|
|