File tree Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Expand file tree Collapse file tree 3 files changed +35
-0
lines changed Original file line number Diff line number Diff line change 5
5
from compas .files import GLTFContent
6
6
from compas .tolerance import TOL
7
7
8
+ # Temporary change the global precision in the TOL class to 12
8
9
TOL .precision = 12
9
10
10
11
BASE_FOLDER = os .path .dirname (__file__ )
@@ -175,3 +176,7 @@ def test_gltf_content():
175
176
assert len (node_0 .children ) == 0
176
177
assert len (content .nodes ) == 1
177
178
assert len (scene .nodes ) == 1
179
+
180
+
181
+ # Reset the precision to its default value
182
+ TOL .precision = TOL .PRECISION
Original file line number Diff line number Diff line change 5
5
from compas .files import STL
6
6
from compas .tolerance import TOL
7
7
8
+ # Temporary change the global precision in the TOL class to 12
8
9
TOL .precision = 12
9
10
10
11
BASE_FOLDER = os .path .dirname (__file__ )
@@ -43,3 +44,7 @@ def test_binary_read_write_fidelity():
43
44
mesh_2 = Mesh .from_stl (fp )
44
45
assert mesh .adjacency == mesh_2 .adjacency
45
46
assert mesh .vertex == mesh_2 .vertex
47
+
48
+
49
+ # Reset the precision to its default value
50
+ TOL .precision = TOL .PRECISION
Original file line number Diff line number Diff line change
1
+ from compas .tolerance import TOL
2
+ from compas .tolerance import Tolerance
3
+ from compas .geometry import Point
4
+
5
+
6
+ def test_tolerance_default_tolerance ():
7
+ assert TOL .precision == Tolerance .PRECISION
8
+ assert TOL .precision == 3
9
+
10
+
11
+ def test_tolerance_format_number ():
12
+ assert TOL .format_number (0 , precision = 3 ) == "0.000"
13
+ assert TOL .format_number (0.5 , precision = 3 ) == "0.500"
14
+ assert TOL .format_number (float (0 ), precision = 3 ) == "0.000"
15
+
16
+
17
+ def test_tolerance_format_number_with_default_precision ():
18
+ assert TOL .format_number (0 ) == "0.000"
19
+ assert TOL .format_number (0.5 ) == "0.500"
20
+ assert TOL .format_number (float (0 )) == "0.000"
21
+
22
+
23
+ def test_tolerance_format_point ():
24
+ point = Point (0 , 0 , 0 )
25
+ assert str (point ) == "Point(x=0.000, y=0.000, z=0.000)"
You can’t perform that action at this time.
0 commit comments