Add test on fit_bbox
This commit is contained in:
parent
a21598eb74
commit
553a896e36
@ -87,10 +87,10 @@ def fit_bbox(data, decimals=0):
|
|||||||
--------
|
--------
|
||||||
bbox : Returns a raw bounding box on the data.
|
bbox : Returns a raw bounding box on the data.
|
||||||
"""
|
"""
|
||||||
bbox = bbox(data)
|
raw_bbox = bbox(data)
|
||||||
|
|
||||||
nbbox = np.round(bbox, decimals)
|
nbbox = np.round(raw_bbox, decimals)
|
||||||
nbbox[0,2] = np.floor(bbox * 10 ** decimals)[0,2] / 10 ** decimals
|
nbbox[0,2] = np.floor(raw_bbox * 10 ** decimals)[0,2] / 10 ** decimals
|
||||||
nbbox[1,2] = np.ceil(bbox * 10 ** decimals)[1,2] / 10 ** decimals
|
nbbox[1,2] = np.ceil(raw_bbox * 10 ** decimals)[1,2] / 10 ** decimals
|
||||||
|
|
||||||
return nbbox
|
return nbbox
|
||||||
|
|||||||
@ -27,6 +27,11 @@ def test_bbox(fix_data):
|
|||||||
res = np.array([fix_data.min(axis=0), fix_data.max(axis=0)])
|
res = np.array([fix_data.min(axis=0), fix_data.max(axis=0)])
|
||||||
assert (utils.bbox(fix_data) == res).all()
|
assert (utils.bbox(fix_data) == res).all()
|
||||||
|
|
||||||
|
def test_fit_bbox(fix_data):
|
||||||
|
res = np.array([[0, 0, 0],
|
||||||
|
[1, 1, 1]])
|
||||||
|
assert (utils.fit_bbox(fix_data) == res).all()
|
||||||
|
|
||||||
def test_read(datadir):
|
def test_read(datadir):
|
||||||
with open(datadir.join('first.txt')) as f:
|
with open(datadir.join('first.txt')) as f:
|
||||||
assert f.read() == 'hullo\n'
|
assert f.read() == 'hullo\n'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user