@@ -1329,7 +1329,7 @@ def test_missing_operator():
1329
1329
# Check that the expression is still there, and can be introspected
1330
1330
# Note the added parentheses. The parser automatically adds these,
1331
1331
# mainly because of possible operator precedence issues in nested expressions.
1332
- assert expr2 .expression == "( a + b) "
1332
+ assert expr2 .expression == "a + b"
1333
1333
# Check that dtype and shape are None
1334
1334
assert expr2 .dtype is None
1335
1335
assert expr2 .shape is None
@@ -1349,8 +1349,50 @@ def test_chain_expressions():
1349
1349
le1 = a ** 3 + blosc2 .sin (a ** 2 )
1350
1350
le2 = le1 < c
1351
1351
le3 = le2 & (b < 0 )
1352
-
1353
1352
le1_ = blosc2 .lazyexpr ("a ** 3 + sin(a ** 2)" , {"a" : a })
1354
1353
le2_ = blosc2 .lazyexpr ("(le1 < c)" , {"le1" : le1_ , "c" : c })
1355
1354
le3_ = blosc2 .lazyexpr ("(le2 & (b < 0))" , {"le2" : le2_ , "b" : b })
1356
1355
assert (le3_ [:] == le3 [:]).all ()
1356
+
1357
+ # TODO: This test should pass eventually
1358
+ # le1 = a ** 3 + blosc2.sin(a ** 2)
1359
+ # le2 = le1 < c
1360
+ # le3 = (b < 0)
1361
+ # le4 = le2 & le3
1362
+ # le1_ = blosc2.lazyexpr("a ** 3 + sin(a ** 2)", {"a": a})
1363
+ # le2_ = blosc2.lazyexpr("(le1 < c)", {"le1": le1_, "c": c})
1364
+ # le3_ = blosc2.lazyexpr("(b < 0)", {"b": b})
1365
+ # le4_ = blosc2.lazyexpr("(le2 & le3)", {"le2": le2_, "le3": le3_})
1366
+ # assert (le4_[:] == le4[:]).all()
1367
+
1368
+
1369
+ # TODO: Test the chaining of multiple persistent lazy expressions
1370
+ # def test_chain_persistentexpressions():
1371
+ # N = 1_000
1372
+ # dtype = "float64"
1373
+ # a = blosc2.linspace(0, 1, N * N, dtype=dtype, shape=(N, N), urlpath="a.b2nd", mode="w")
1374
+ # b = blosc2.linspace(1, 2, N * N, dtype=dtype, shape=(N, N), urlpath="b.b2nd", mode="w")
1375
+ # c = blosc2.linspace(0, 1, N, dtype=dtype, shape=(N,), urlpath="c.b2nd", mode="w")
1376
+ #
1377
+ # le1 = a ** 3 + blosc2.sin(a ** 2)
1378
+ # le2 = le1 < c
1379
+ # le3 = (b < 0)
1380
+ # le4 = le2 & le3
1381
+ #
1382
+ # le1_ = blosc2.lazyexpr("a ** 3 + sin(a ** 2)", {"a": a})
1383
+ # le1_.save("expr1.b2nd", mode="w")
1384
+ # myle1 = blosc2.open("expr1.b2nd")
1385
+ #
1386
+ # le2_ = blosc2.lazyexpr("(le1 < c)", {"le1": myle1, "c": c})
1387
+ # le2_.save("expr2.b2nd", mode="w")
1388
+ # myle2 = blosc2.open("expr2.b2nd")
1389
+ #
1390
+ # le3_ = blosc2.lazyexpr("(b < 0)", {"b": b})
1391
+ # le3_.save("expr3.b2nd", mode="w")
1392
+ # myle3 = blosc2.open("expr3.b2nd")
1393
+ #
1394
+ # le4_ = blosc2.lazyexpr("(le2 & le3)", {"le2": myle2, "le3": myle3})
1395
+ # le4_.save("expr4.b2nd", mode="w")
1396
+ # myle4 = blosc2.open("expr4.b2nd")
1397
+ # print((myle4[:] == le4[:]).all())
1398
+ #
0 commit comments