-
Notifications
You must be signed in to change notification settings - Fork 110
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 #1380 from compas-dev/yck011522/test_tol_format_nu…
…mber Testing Tolerance.format_number
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 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
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,25 @@ | ||
from compas.tolerance import TOL | ||
from compas.tolerance import Tolerance | ||
from compas.geometry import Point | ||
|
||
|
||
def test_tolerance_default_tolerance(): | ||
assert TOL.precision == Tolerance.PRECISION | ||
assert TOL.precision == 3 | ||
|
||
|
||
def test_tolerance_format_number(): | ||
assert TOL.format_number(0, precision=3) == "0.000" | ||
assert TOL.format_number(0.5, precision=3) == "0.500" | ||
assert TOL.format_number(float(0), precision=3) == "0.000" | ||
|
||
|
||
def test_tolerance_format_number_with_default_precision(): | ||
assert TOL.format_number(0) == "0.000" | ||
assert TOL.format_number(0.5) == "0.500" | ||
assert TOL.format_number(float(0)) == "0.000" | ||
|
||
|
||
def test_tolerance_format_point(): | ||
point = Point(0, 0, 0) | ||
assert str(point) == "Point(x=0.000, y=0.000, z=0.000)" |