-
Notifications
You must be signed in to change notification settings - Fork 5
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
165 additions
and
12 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
58 changes: 56 additions & 2 deletions
58
tests/beignet/datasets/test__random_euler_angle_dataset.py
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 |
---|---|---|
@@ -1,3 +1,57 @@ | ||
import beignet | ||
import hypothesis.strategies | ||
from beignet.datasets import RandomEulerAngleDataset | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
size = function( | ||
hypothesis.strategies.integers( | ||
min_value=1, | ||
max_value=8, | ||
), | ||
) | ||
|
||
axes = function( | ||
hypothesis.strategies.sampled_from( | ||
[ | ||
"xyz", | ||
"xzy", | ||
"yxz", | ||
"yzx", | ||
"zxy", | ||
"zyx", | ||
"XYZ", | ||
"XZY", | ||
"YXZ", | ||
"YZX", | ||
"ZXY", | ||
"ZYX", | ||
] | ||
), | ||
) | ||
|
||
degrees = function(hypothesis.strategies.booleans()) | ||
|
||
return ( | ||
{ | ||
"size": size, | ||
"axes": axes, | ||
"degrees": degrees, | ||
}, | ||
beignet.random_euler_angle(size, axes=axes, degrees=degrees), | ||
) | ||
|
||
|
||
class TestRandomEulerAngleDataset: | ||
def test___init__(self): | ||
assert True | ||
@hypothesis.given(_strategy()) | ||
def test___init__(self, data): | ||
parameters, output = data | ||
|
||
dataset = RandomEulerAngleDataset(**parameters) | ||
|
||
assert dataset.data.shape == output.shape | ||
|
||
assert dataset.data.dtype == output.dtype | ||
|
||
assert dataset.data.layout == output.layout |
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
import beignet | ||
import hypothesis.strategies | ||
from beignet.datasets import RandomQuaternionDataset | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
size = function( | ||
hypothesis.strategies.integers( | ||
min_value=1, | ||
max_value=8, | ||
), | ||
) | ||
|
||
canonical = function(hypothesis.strategies.booleans()) | ||
|
||
return ( | ||
{ | ||
"size": size, | ||
"canonical": canonical, | ||
}, | ||
beignet.random_quaternion(size, canonical=canonical), | ||
) | ||
|
||
|
||
class TestRandomQuaternionDataset: | ||
def test___init__(self): | ||
assert True | ||
@hypothesis.given(_strategy()) | ||
def test___init__(self, data): | ||
parameters, output = data | ||
|
||
dataset = RandomQuaternionDataset(**parameters) | ||
|
||
assert dataset.data.shape == output.shape | ||
|
||
assert dataset.data.dtype == output.dtype | ||
|
||
assert dataset.data.layout == output.layout |
35 changes: 33 additions & 2 deletions
35
tests/beignet/datasets/test__random_rotation_matrix_dataset.py
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 |
---|---|---|
@@ -1,3 +1,34 @@ | ||
import beignet | ||
import hypothesis.strategies | ||
from beignet.datasets import RandomRotationMatrixDataset | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
size = function( | ||
hypothesis.strategies.integers( | ||
min_value=1, | ||
max_value=8, | ||
), | ||
) | ||
|
||
return ( | ||
{ | ||
"size": size, | ||
}, | ||
beignet.random_rotation_matrix(size), | ||
) | ||
|
||
|
||
class TestRandomRotationMatrixDataset: | ||
def test___init__(self): | ||
assert True | ||
@hypothesis.given(_strategy()) | ||
def test___init__(self, data): | ||
parameters, output = data | ||
|
||
dataset = RandomRotationMatrixDataset(**parameters) | ||
|
||
assert dataset.data.shape == output.shape | ||
|
||
assert dataset.data.dtype == output.dtype | ||
|
||
assert dataset.data.layout == output.layout |
38 changes: 36 additions & 2 deletions
38
tests/beignet/datasets/test__random_rotation_vector_dataset.py
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 |
---|---|---|
@@ -1,3 +1,37 @@ | ||
import beignet | ||
import hypothesis.strategies | ||
from beignet.datasets import RandomRotationVectorDataset | ||
|
||
|
||
@hypothesis.strategies.composite | ||
def _strategy(function): | ||
size = function( | ||
hypothesis.strategies.integers( | ||
min_value=1, | ||
max_value=8, | ||
), | ||
) | ||
|
||
degrees = function(hypothesis.strategies.booleans()) | ||
|
||
return ( | ||
{ | ||
"size": size, | ||
"degrees": degrees, | ||
}, | ||
beignet.random_rotation_vector(size, degrees=degrees), | ||
) | ||
|
||
|
||
class TestRandomRotationVectorDataset: | ||
def test___init__(self): | ||
assert True | ||
@hypothesis.given(_strategy()) | ||
def test___init__(self, data): | ||
parameters, output = data | ||
|
||
dataset = RandomRotationVectorDataset(**parameters) | ||
|
||
assert dataset.data.shape == output.shape | ||
|
||
assert dataset.data.dtype == output.dtype | ||
|
||
assert dataset.data.layout == output.layout |