-
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.
Browse files
Browse the repository at this point in the history
* feat(dri-1028): add proportion and strokes_rate unit types * feat(dri-1028): fix arcmin typo * feat(dri-1028): add Hz alias to angular_velocity 1/s
- Loading branch information
1 parent
479859c
commit 184d4ed
Showing
8 changed files
with
135 additions
and
2 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
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 |
---|---|---|
|
@@ -13,7 +13,8 @@ | |
}, | ||
"to_anchor": 60, | ||
"aliases": [ | ||
"1/s" | ||
"1/s", | ||
"Hz" | ||
] | ||
}, | ||
"rev/s": { | ||
|
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,39 @@ | ||
metric = imperial = { | ||
"%": { | ||
"name": { | ||
"singular": "%", | ||
"plural": "%", | ||
"display": "%" | ||
}, | ||
"to_anchor": 1, | ||
"aliases": [ | ||
"%" | ||
] | ||
}, | ||
"Fraction": { | ||
"name": { | ||
"singular": "Fraction", | ||
"plural": "Fraction", | ||
"display": "Fraction (0-1)" | ||
}, | ||
"to_anchor": 100, | ||
"aliases": [ | ||
"0-1" | ||
] | ||
} | ||
} | ||
|
||
rule = { | ||
"metric": metric, | ||
"imperial": imperial, | ||
"_anchors": { | ||
"metric": { | ||
"unit": "%", | ||
"ratio": 1 | ||
}, | ||
"imperial": { | ||
"unit": "%", | ||
"ratio": 1 | ||
} | ||
} | ||
} |
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,56 @@ | ||
metric = imperial = { | ||
"strokes/min": { | ||
"name": { | ||
"singular": "stroke per minute", | ||
"plural": "stroke per minute", | ||
"display": "strokes/min" | ||
}, | ||
"to_anchor": 1, | ||
"aliases": [ | ||
"strokes/min", | ||
"spm", | ||
"1/m" | ||
] | ||
}, | ||
"strokes/sec": { | ||
"name": { | ||
"singular": "stroke per second", | ||
"plural": "stroke per second", | ||
"display": "strokes/sec" | ||
}, | ||
"to_anchor": 60, | ||
"aliases": [ | ||
"strokes/sec", | ||
"sps", | ||
"1/s" | ||
] | ||
}, | ||
"strokes/h": { | ||
"name": { | ||
"singular": "stroke per hour", | ||
"plural": "stroke per hour", | ||
"display": "strokes/h" | ||
}, | ||
"to_anchor": 1/60, | ||
"aliases": [ | ||
"strokes/h", | ||
"sph", | ||
"1/h" | ||
] | ||
} | ||
} | ||
|
||
rule = { | ||
"metric": metric, | ||
"imperial": imperial, | ||
"_anchors": { | ||
"metric": { | ||
"unit": "strokes/min", | ||
"ratio": 1 | ||
}, | ||
"imperial": { | ||
"unit": "strokes/min", | ||
"ratio": 1 | ||
} | ||
} | ||
} |
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,11 @@ | ||
from .utils import convert_units | ||
|
||
# test cases | ||
cases = [ | ||
{"from": "%", "amount": 1, "to": "Fraction", "expected": 0.01}, | ||
{"from": "Fraction", "amount": 1, "to": '%', "expected": 100}, | ||
] | ||
|
||
|
||
def test(): | ||
convert_units(cases) |
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,20 @@ | ||
from .utils import convert_units | ||
|
||
# Test cases | ||
cases = [ | ||
{"from": "strokes/min", "amount": 1, "to": "strokes/sec", | ||
"expected": 0.016666666666666666}, | ||
{"from": "strokes/min", "amount": 1, "to": "strokes/h", "expected": 60}, | ||
|
||
{"from": "strokes/sec", "amount": 1, "to": "strokes/min", "expected": 60}, | ||
{"from": "strokes/sec", "amount": 1, "to": "strokes/h", "expected": 3600}, | ||
|
||
{"from": "strokes/h", "amount": 1, "to": "strokes/sec", | ||
"expected": 0.0002777777777777778}, | ||
{"from": "strokes/h", "amount": 1, "to": "strokes/min", | ||
"expected": 0.016666666666666666}, | ||
] | ||
|
||
|
||
def test(): | ||
convert_units(cases) |