-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from ibois-epfl/tests
testing for core functionalities
- Loading branch information
Showing
11 changed files
with
113 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: test geo basics | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up conda environment | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
activate-environment: Carnutes | ||
environment-file: environment.yml | ||
|
||
- name: activate conda environment | ||
run: conda activate Carnutes | ||
|
||
- name: run tests | ||
run: pytest tests/test_geometry_basics.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
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 |
---|---|---|
|
@@ -7,4 +7,5 @@ dependencies: | |
- ZODB==6.0 | ||
- open3d==0.18.0 | ||
- igraph==0.11.6 | ||
- pytest==8.3.2 | ||
# - pc_skeletor |
Binary file not shown.
Binary file not shown.
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 +1 @@ | ||
8116 | ||
77841 |
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
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,61 @@ | ||
import sys | ||
import os | ||
import copy | ||
|
||
import pytest | ||
|
||
current_dir = os.path.dirname(os.path.realpath(__file__)) | ||
sys.path.append(current_dir + "/..") | ||
sys.path.append(current_dir + "/../src") | ||
|
||
from src.utils import geometry as geo | ||
from src.utils import database_reader | ||
from src.utils import tree | ||
|
||
@pytest.fixture | ||
def get_skeleton_length(): | ||
yield tree.SKELETON_LENGTH | ||
|
||
@pytest.fixture | ||
def get_database(): | ||
reader = database_reader.DatabaseReader(current_dir + "/../src/database/tree_database.fs") | ||
yield reader | ||
reader.close() | ||
|
||
def test_Pointcloud(): | ||
point_cloud = geo.Pointcloud([[1, 2, 3], [4, 5, 6]]) | ||
assert point_cloud.points == [[1, 2, 3], [4, 5, 6]] | ||
assert point_cloud.colors == None | ||
|
||
def test_Mesh(): | ||
vertices_list = [[1, 0, 0], | ||
[0, 1, 0], | ||
[0, 0, 1], | ||
[0, 0, 0]] | ||
faces_list = [[0, 1, 2], | ||
[0, 1, 3]] | ||
mesh = geo.Mesh(vertices_list, faces_list) | ||
assert mesh.vertices[0] == [1, 0, 0] | ||
assert len(mesh.vertices) == 4 | ||
assert mesh.faces[0] == [0, 1, 2] | ||
assert len(mesh.faces) == 2 | ||
assert mesh.colors == None | ||
|
||
def test_database_reader(get_database): | ||
reader = get_database | ||
tree_id = 0 | ||
my_tree = reader.get_tree(tree_id) | ||
my_tree = copy.deepcopy(my_tree) | ||
reader.close() | ||
assert my_tree.id == 0 | ||
assert my_tree.name == "tree_0" | ||
|
||
def test_point_cloud(get_skeleton_length, get_database): | ||
reader = get_database | ||
tree_id = 0 | ||
my_tree = reader.get_tree(tree_id) | ||
my_tree = copy.deepcopy(my_tree) | ||
reader.close() | ||
assert len(my_tree.skeleton.points) == get_skeleton_length | ||
assert len(my_tree.point_cloud.points) == 6388 | ||
assert len(my_tree.point_cloud.colors) == len(my_tree.point_cloud.points) |