Skip to content

Commit

Permalink
Cup (#52)
Browse files Browse the repository at this point in the history
* feat : cup added to WATER_UNITS_MAP

* fix : tests updated

* doc : CHANGELOG.md updated
  • Loading branch information
sepandhaghighi authored Dec 2, 2024
1 parent cb84967 commit 269416c
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 21 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- 3 new water units
- 4 new water units
1. Tablespoon (`tbsp`)
2. Teaspoon (`tsp`)
3. Dessertspoon (`dsp`)
4. Cup (`cup`)
## [0.8] - 2024-11-29
### Added
- 1 new coffee unit
Expand Down
1 change: 1 addition & 0 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@
"tbsp": {"name": "tablespoon", "rate": 0.067628},
"tsp": {"name": "teaspoon", "rate": 0.20288},
"dsp": {"name": "dessertspoon", "rate": 0.10144},
"cup": {"name": "cup", "rate": 0.0042268},
}
42 changes: 22 additions & 20 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,17 @@
>>> show_water_units_list()
Water units list:
<BLANKLINE>
1. `dsp` - dessertspoon
2. `g` - gram
3. `kg` - kilogram
4. `l` - liter
5. `lb` - pound
6. `mg` - milligram
7. `ml` - milliliter
8. `oz` - ounce
9. `tbsp` - tablespoon
10. `tsp` - teaspoon
1. `cup` - cup
2. `dsp` - dessertspoon
3. `g` - gram
4. `kg` - kilogram
5. `l` - liter
6. `lb` - pound
7. `mg` - milligram
8. `ml` - milliliter
9. `oz` - ounce
10. `tbsp` - tablespoon
11. `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 @@ -401,14 +402,15 @@
>>> run(args)
Water units list:
<BLANKLINE>
1. `dsp` - dessertspoon
2. `g` - gram
3. `kg` - kilogram
4. `l` - liter
5. `lb` - pound
6. `mg` - milligram
7. `ml` - milliliter
8. `oz` - ounce
9. `tbsp` - tablespoon
10. `tsp` - teaspoon
1. `cup` - cup
2. `dsp` - dessertspoon
3. `g` - gram
4. `kg` - kilogram
5. `l` - liter
6. `lb` - pound
7. `mg` - milligram
8. `ml` - milliliter
9. `oz` - ounce
10. `tbsp` - tablespoon
11. `tsp` - teaspoon
"""
4 changes: 4 additions & 0 deletions test/verified_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,4 +343,8 @@
True
>>> convert_water(240, "dsp", True) == 2365.930599369085 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "cup") == 1.014432 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "cup", True) == 56780.54320052995 # https://www.howmany.wiki/wv/
True
"""

0 comments on commit 269416c

Please sign in to comment.