Skip to content

Commit

Permalink
Adapt test to windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ch-sa committed Jan 9, 2022
1 parent 142fd8a commit 6e9babc
Showing 1 changed file with 26 additions and 28 deletions.
54 changes: 26 additions & 28 deletions labelCloud/tests/unit/test_label_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,46 +47,44 @@ def test_vertices_export(bounding_box, tmppath):

def test_centroid_rel_export(bounding_box, tmppath):
label_manager = LabelManager(strategy="centroid_rel", path_to_label_folder=tmppath)
label_manager.export_labels(Path("testfolder/testpcd.ply"), [bounding_box])
pcd_path = Path("testfolder/testpcd.ply")
label_manager.export_labels(pcd_path, [bounding_box])

with tmppath.joinpath("testpcd.json").open("r") as read_file:
data = json.load(read_file)

assert data == {
"folder": "testfolder",
"filename": "testpcd.ply",
"path": "testfolder/testpcd.ply",
"objects": [
{
"name": "test_bbox",
"centroid": {"x": 0, "y": 0, "z": 0},
"dimensions": {"length": 1, "width": 1, "height": 1},
"rotations": {"x": 1.57079633, "y": 3.14159265, "z": -1.57079633},
}
],
}
assert data["folder"] == "testfolder"
assert data["filename"] == "testpcd.ply"
assert data["path"] == str(pcd_path)
assert data["objects"] == [
{
"name": "test_bbox",
"centroid": {"x": 0, "y": 0, "z": 0},
"dimensions": {"length": 1, "width": 1, "height": 1},
"rotations": {"x": 1.57079633, "y": 3.14159265, "z": -1.57079633},
}
]


def test_centroid_abs_export(bounding_box, tmppath):
label_manager = LabelManager(strategy="centroid_abs", path_to_label_folder=tmppath)
label_manager.export_labels(Path("testfolder/testpcd.ply"), [bounding_box])
pcd_path = Path("testfolder/testpcd.ply")
label_manager.export_labels(pcd_path, [bounding_box])

with tmppath.joinpath("testpcd.json").open("r") as read_file:
data = json.load(read_file)

assert data == {
"folder": "testfolder",
"filename": "testpcd.ply",
"path": "testfolder/testpcd.ply",
"objects": [
{
"name": "test_bbox",
"centroid": {"x": 0, "y": 0, "z": 0},
"dimensions": {"length": 1, "width": 1, "height": 1},
"rotations": {"x": 90, "y": 180, "z": 270},
}
],
}
assert data["folder"] == "testfolder"
assert data["filename"] == "testpcd.ply"
assert data["path"] == str(pcd_path)
assert data["objects"] == [
{
"name": "test_bbox",
"centroid": {"x": 0, "y": 0, "z": 0},
"dimensions": {"length": 1, "width": 1, "height": 1},
"rotations": {"x": 90, "y": 180, "z": 270},
}
]


def test_kitti_export(bounding_box, tmppath):
Expand Down

0 comments on commit 6e9babc

Please sign in to comment.