Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troy pounds added for water and coffee #73

Merged
merged 3 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- 1 new water unit
1. Troy Pounds (`t lb`)
- 1 new coffee unit
1. Troy Pounds (`t lb`)
## [1.1] - 2025-01-02
### Added
- 5 new water units
Expand Down
2 changes: 2 additions & 0 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
"t oz": {"name": "troy ounce", "rate": 0.032151},
"gr": {"name": "grain", "rate": 15.4324},
"ct": {"name": "carat", "rate": 5},
"t lb": {"name": "troy pound", "rate": 0.0026792289},
}

WATER_UNITS_MAP = {
Expand All @@ -227,4 +228,5 @@
"t oz": {"name": "troy ounce", "rate": 0.032151},
"gr": {"name": "grain", "rate": 15.4324},
"ct": {"name": "carat", "rate": 5},
"t lb": {"name": "troy pound", "rate": 0.0026792289},
}
28 changes: 16 additions & 12 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@
8. `lb` - pound
9. `mg` - milligram
10. `oz` - ounce
11. `t oz` - troy ounce
12. `tbsp` - tablespoon
13. `tsp` - teaspoon
11. `t lb` - troy pound
12. `t oz` - troy ounce
13. `tbsp` - tablespoon
14. `tsp` - teaspoon
>>> show_water_units_list()
Water units list:
<BLANKLINE>
Expand All @@ -173,9 +174,10 @@
14. `oz` - ounce
15. `pt` - pint
16. `qt` - quart
17. `t oz` - troy ounce
18. `tbsp` - tablespoon
19. `tsp` - teaspoon
17. `t lb` - troy pound
18. `t oz` - troy ounce
19. `tbsp` - tablespoon
20. `tsp` - teaspoon
>>> test_params = {"method":"v60", "cups":1, "water":335, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method", 'coffee_unit': 'g'}
>>> calc_coffee(test_params)
20.1
Expand Down Expand Up @@ -409,9 +411,10 @@
8. `lb` - pound
9. `mg` - milligram
10. `oz` - ounce
11. `t oz` - troy ounce
12. `tbsp` - tablespoon
13. `tsp` - teaspoon
11. `t lb` - troy pound
12. `t oz` - troy ounce
13. `tbsp` - tablespoon
14. `tsp` - teaspoon
>>> args = parser.parse_args(["--water-units-list"])
>>> run(args)
Water units list:
Expand All @@ -432,7 +435,8 @@
14. `oz` - ounce
15. `pt` - pint
16. `qt` - quart
17. `t oz` - troy ounce
18. `tbsp` - tablespoon
19. `tsp` - teaspoon
17. `t lb` - troy pound
18. `t oz` - troy ounce
19. `tbsp` - tablespoon
20. `tsp` - teaspoon
"""
6 changes: 6 additions & 0 deletions test/verified_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,4 +385,10 @@
True
>>> round(convert_water(240, "cl", True), 1) == 2400.0 # https://www.metric-conversions.org/volume/centiliters-to-milliliters.htm
True
>>> round(convert_coffee(240, "t lb"), 3) == 0.643 # https://www.metric-conversions.org/weight/grams-to-troy-pounds.htm
True
>>> round(convert_water(240, "t lb"), 3) == 0.643 # https://www.metric-conversions.org/weight/grams-to-troy-pounds.htm
True
>>> round(convert_water(240, "t lb", True), 1) == 89578.0 # https://www.metric-conversions.org/weight/troy-pounds-to-grams.htm
True
"""