-
Notifications
You must be signed in to change notification settings - Fork 127
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 #60 from Jon-Becker/jon-becker/float-validation
fix(validation): floating point rounding error validation
- Loading branch information
Showing
4 changed files
with
221 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -32,3 +32,5 @@ coverage.xml | |
|
||
*metadata/*.json | ||
*images/*.png | ||
|
||
.DS_Store |
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,216 @@ | ||
from unittest.mock import patch | ||
|
||
from src.common.validate import validate_config | ||
|
||
|
||
@patch("os.path.isfile", return_value=True) | ||
def test_floating_point_errors(mock_isfile): | ||
valid_config = { | ||
"layers": [ | ||
{ | ||
"name": "Background", | ||
"values": [ | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"2.5.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"9.2.png", | ||
"2.5.png", | ||
"1.4.png", | ||
"0.3.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.2.png", | ||
"0.7.png", | ||
"1.4.png", | ||
"0.9.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"0.5.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"0.2.png", | ||
"1.png", | ||
"2.2.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"2.png", | ||
"0.7.png", | ||
"1.8.png", | ||
"0.9.png", | ||
"1.8.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.7.png", | ||
"1.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"0.9.png", | ||
"1.7.png", | ||
"1.8.png", | ||
], | ||
"trait_path": "./trait-layers/foreground", | ||
"filename": [ | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"2.5.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"9.2.png", | ||
"2.5.png", | ||
"1.4.png", | ||
"0.3.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.2.png", | ||
"0.7.png", | ||
"1.4.png", | ||
"0.9.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"0.5.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"0.2.png", | ||
"1.png", | ||
"2.2.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"2.png", | ||
"0.7.png", | ||
"1.8.png", | ||
"0.9.png", | ||
"1.8.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.4.png", | ||
"1.7.png", | ||
"1.7.png", | ||
"1.8.png", | ||
"1.7.png", | ||
"1.png", | ||
"1.7.png", | ||
"1.4.png", | ||
"0.9.png", | ||
"1.7.png", | ||
"1.8.png", | ||
], | ||
"weights": [ | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.4, | ||
2.5, | ||
1.4, | ||
1.7, | ||
9.2, | ||
2.5, | ||
1.4, | ||
0.3, | ||
1.7, | ||
1.7, | ||
1.2, | ||
0.7, | ||
1.4, | ||
0.9, | ||
1.4, | ||
1.7, | ||
0.5, | ||
1.7, | ||
1.4, | ||
0.2, | ||
1, | ||
2.2, | ||
1.7, | ||
1.8, | ||
1.4, | ||
1.7, | ||
1.4, | ||
1.7, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.7, | ||
1.7, | ||
1.8, | ||
1.7, | ||
1.4, | ||
1.4, | ||
1.7, | ||
2, | ||
0.7, | ||
1.8, | ||
0.9, | ||
1.8, | ||
1.4, | ||
1.4, | ||
1.4, | ||
1.7, | ||
1.7, | ||
1.8, | ||
1.7, | ||
1, | ||
1.7, | ||
1.4, | ||
0.9, | ||
1.7, | ||
1.8, | ||
], | ||
} | ||
], | ||
"incompatibilities": [], | ||
"baseURI": ".", | ||
"name": "NFT #", | ||
"description": "This is a description for this NFT series.", | ||
} | ||
|
||
assert validate_config(valid_config) is None # It should not raise an exception |