@@ -1233,7 +1233,7 @@ def test_transpose(self):
1233
1233
self .assertEqual (la .transpose ().axes_names ,
1234
1234
['lipro' , 'sex' , 'geo' , 'age' ])
1235
1235
1236
- def test_arithmetics (self ):
1236
+ def test_binary_ops (self ):
1237
1237
raw = self .small_data
1238
1238
la = self .small
1239
1239
@@ -1262,13 +1262,20 @@ def test_arithmetics(self):
1262
1262
# test adding two larrays with different axes order
1263
1263
self ._assert_equal_raw (la + la .transpose (), raw * 2 )
1264
1264
1265
- # def test_boolean_indexing(self):
1266
- # raw = self.small_data
1267
- # la = self.small
1268
- #
1269
- # self._assert_equal_raw(la > 2, raw > 2)
1270
- # FIXME this fails: it should return a 1d array with "combined ticks"
1271
- # self._assert_equal_raw(la[la > 2], raw[raw > 2])
1265
+ def test_unary_ops (self ):
1266
+ raw = self .small_data
1267
+ la = self .small
1268
+
1269
+ # using numpy functions
1270
+ self ._assert_equal_raw (np .abs (la - 10 ), np .abs (raw - 10 ))
1271
+ self ._assert_equal_raw (np .negative (la ), np .negative (raw ))
1272
+ self ._assert_equal_raw (np .invert (la ), np .invert (raw ))
1273
+
1274
+ # using python builtin ops
1275
+ self ._assert_equal_raw (abs (la - 10 ), abs (raw - 10 ))
1276
+ self ._assert_equal_raw (- la , - raw )
1277
+ self ._assert_equal_raw (+ la , + raw )
1278
+ self ._assert_equal_raw (~ la , ~ raw )
1272
1279
1273
1280
def test_mean (self ):
1274
1281
la = self .small
0 commit comments