From 238de5ae7faa4052b2c6575b64b43ad5a0660678 Mon Sep 17 00:00:00 2001 From: Andrew Davison Date: Tue, 9 Nov 2021 13:20:48 +0100 Subject: [PATCH] test some edge cases --- test/test_ufunc.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/test_ufunc.py b/test/test_ufunc.py index eb069ad..6be5c36 100644 --- a/test/test_ufunc.py +++ b/test/test_ufunc.py @@ -4,9 +4,10 @@ Copyright Andrew P. Davison, 2012-2017 """ -from lazyarray import larray, sqrt, cos, power +from lazyarray import larray, sqrt, cos, power, fmod import numpy as np from numpy.testing import assert_array_equal, assert_array_almost_equal +from nose.tools import assert_raises def test_sqrt_from_array(): @@ -44,7 +45,18 @@ def clock(): decimal=15) -def testpower_from_array(): +def test_power_from_array(): A = larray(np.array([1, 4, 9, 16, 25])) assert_array_equal(power(A, 0.5).evaluate(), np.arange(1, 6)) + + +def test_power_with_plain_array(): + A = np.array([1, 4, 9, 16, 25]) + assert_array_equal(power(A, 0.5), np.arange(1, 6)) + + +def test_fmod_with_array_as_2nd_arg(): + A = larray(np.array([1, 4, 9, 16, 25])) + B = larray(np.array([1, 4, 9, 16, 25])) + assert_raises(TypeError, fmod, A, B)