Skip to content

Commit 8bbbf97

Browse files
authored
Merge pull request #64 from IntelPython/update_tests
update test to avoid deprecation warning
2 parents e8b45c5 + 40b13aa commit 8bbbf97

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

.github/workflows/conda-package.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Conda package
22

3-
on: push
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions: read-all
610

README.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44
# `mkl_umath`
55

6-
`mkl_umath._ufuncs` exposes [Intel(R) Math Kernel Library](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html)
6+
`mkl_umath._ufuncs` exposes [Intel® OneAPI Math Kernel Library (OneMKL)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html)
77
powered version of loops used in the patched version of [NumPy](https://numpy.org), that used to be included in
8-
[Intel(R) Distribution for Python*](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html).
8+
[Intel® Distribution for Python*](https://www.intel.com/content/www/us/en/developer/tools/oneapi/distribution-for-python.html).
99

1010
Patches were factored out per community feedback ([NEP-36](https://numpy.org/neps/nep-0036-fair-play.html)).
1111

12-
`mkl_umath` started as a part of Intel (R) Distribution for Python* optimizations to NumPy, and is now being released
13-
as a stand-alone package. It can be installed into conda environment using
12+
`mkl_umath` started as a part of Intel® Distribution for Python* optimizations to NumPy, and is now being released
13+
as a stand-alone package. It can be installed into conda environment using:
1414

1515
```
1616
conda install -c https://software.repos.intel.com/python/conda mkl_umath
1717
```
1818

1919
---
2020

21-
To install mkl_umath Pypi package please use following command:
21+
To install mkl_umath PyPI package please use following command:
2222

2323
```
2424
python -m pip install --i https://software.repos.intel.com/python/pypi -extra-index-url https://pypi.org/simple mkl_umath
2525
```
2626

27-
If command above installs NumPy package from the Pypi, please use following command to install Intel optimized NumPy wheel package from Intel Pypi Cloud:
27+
If command above installs NumPy package from the PyPI, please use the following command to install Intel optimized NumPy wheel package from Intel PyPI Cloud:
2828

2929
```
3030
python -m pip install --i https://software.repos.intel.com/python/pypi -extra-index-url https://pypi.org/simple mkl_umath numpy==<numpy_version>
@@ -36,7 +36,7 @@ Where `<numpy_version>` should be the latest version from https://software.repos
3636

3737
## Building
3838

39-
Intel(R) C compiler and Intel(R) Math Kernel Library are required to build `mkl_umath` from source:
39+
Intel® C compiler and Intel® OneMKL are required to build `mkl_umath` from source:
4040

4141
```sh
4242
# ensure that MKL is installed into Python prefix, Intel LLVM compiler is activated

mkl_umath/tests/test_basic.py

+11-15
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import pytest
2727
import numpy as np
2828
import mkl_umath._ufuncs as mu
29-
import numpy.core.umath as nu
3029

3130
np.random.seed(42)
3231

@@ -56,10 +55,10 @@ def get_args(args_str):
5655
for umath in umaths:
5756
mkl_umath = getattr(mu, umath)
5857
types = mkl_umath.types
59-
for type in types:
60-
args_str = type[:type.find('->')]
58+
for type_ in types:
59+
args_str = type_[:type_.find('->')]
6160
args = get_args(args_str)
62-
generated_cases[(umath, type)] = args
61+
generated_cases[(umath, type_)] = args
6362

6463
additional_cases = {
6564
('arccosh', 'f->f'): (np.single(np.random.random_sample() + 1),),
@@ -68,23 +67,20 @@ def get_args(args_str):
6867

6968
test_cases = {**generated_cases, **additional_cases}
7069

71-
@pytest.mark.parametrize("case", list(test_cases.keys()))
70+
def get_id(val):
71+
return val.__str__()
72+
73+
@pytest.mark.parametrize("case", test_cases, ids=get_id)
7274
def test_umath(case):
73-
umath, type = case
75+
umath, _ = case
7476
args = test_cases[case]
7577
mkl_umath = getattr(mu, umath)
76-
np_umath = getattr(nu, umath)
77-
print('*'*80)
78-
print(f"Testing {umath} with type {type}")
79-
print("args:", args)
78+
np_umath = getattr(np, umath)
8079

8180
mkl_res = mkl_umath(*args)
8281
np_res = np_umath(*args)
83-
84-
print("mkl res:", mkl_res)
85-
print("npy res:", np_res)
86-
87-
assert np.allclose(mkl_res, np_res), f"Results for {umath} do not match"
82+
83+
assert np.allclose(mkl_res, np_res), f"Results for '{umath}': mkl_res: {mkl_res}, np_res: {np_res}"
8884

8985
def test_cases_count():
9086
print("Test cases count:", len(test_cases))

0 commit comments

Comments
 (0)