-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
118 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import unittest, os | ||
|
||
import tiledb | ||
import numpy as np | ||
from tiledb import TileDBError, core | ||
from tiledb.tests.common import DiskTestCase | ||
from numpy.testing import assert_array_equal | ||
|
||
class CoreCCTest(DiskTestCase): | ||
|
||
def test_pyquery_basic(self): | ||
ctx = tiledb.default_ctx() | ||
uri = self.path("test_pyquery_basic") | ||
tiledb.from_numpy(uri, np.random.rand(4)) | ||
|
||
a = tiledb.open(uri) | ||
q = core.PyQuery(ctx, a, ("",), False) | ||
|
||
try: | ||
q.test_err("bad foo happened") | ||
except Exception as exc: | ||
assert isinstance(exc, tiledb.TileDBError) | ||
assert exc.message == "bad foo happened" | ||
|
||
q.set_ranges([[(0, 3)]]) | ||
|
||
with self.assertRaises(TileDBError): | ||
q.set_ranges([[(0, 3.0)]]) | ||
|
||
q.set_ranges([[(0, np.int32(3))]]) | ||
|
||
with self.assertRaises(TileDBError): | ||
q.set_ranges([[(3, "a")]]) | ||
|
||
with self.assertRaisesRegex( | ||
TileDBError, | ||
"Failed to cast dim range '\\(1.2344, 5.6789\\)' to dim type UINT64.*$", | ||
): | ||
q.set_ranges([[(1.2344, 5.6789)]]) | ||
|
||
with self.assertRaisesRegex( | ||
TileDBError, | ||
"Failed to cast dim range '\\('aa', 'bbbb'\\)' to dim type UINT64.*$", | ||
): | ||
q.set_ranges([[("aa", "bbbb")]]) | ||
|
||
a.close() | ||
a = tiledb.open(uri) | ||
q2 = core.PyQuery(ctx, a, ("",), False) | ||
|
||
q2.set_ranges([[(0,3)]]) | ||
q2.submit() | ||
res = q2.results()[''][0] | ||
res.dtype = np.double | ||
assert_array_equal(res, a[:]) | ||
|
||
a.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters