Skip to content

Commit

Permalink
Spoons (#50)
Browse files Browse the repository at this point in the history
* feat : WATER_UNITS_MAP updated

* fix : tests updated

* fix : functions_test.py updated

* doc : CHANGELOG.md updated
  • Loading branch information
sepandhaghighi authored Nov 30, 2024
1 parent e4fd38a commit ff6a9a5
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 15 deletions.
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
- 3 new water units
1. Tablespoon (`tbsp`)
2. Teaspoon (`tsp`)
3. Dessertspoon (`dsp`)
## [0.8] - 2024-11-29
### Added
- 1 new coffee unit
Expand Down
5 changes: 4 additions & 1 deletion mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,8 @@
"oz": {"name": "ounce", "rate": 0.03527396195},
"lb": {"name": "pound", "rate": 0.00220462262185},
"mg": {"name": "milligram", "rate": 1000},
"kg": {"name": "kilogram", "rate": 0.001}
"kg": {"name": "kilogram", "rate": 0.001},
"tbsp": {"name": "tablespoon", "rate": 0.067628},
"tsp": {"name": "teaspoon", "rate": 0.20288},
"dsp": {"name": "dessertspoon", "rate": 0.10144},
}
34 changes: 20 additions & 14 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,16 @@
>>> show_water_units_list()
Water units list:
<BLANKLINE>
1. `g` - gram
2. `kg` - kilogram
3. `l` - liter
4. `lb` - pound
5. `mg` - milligram
6. `ml` - milliliter
7. `oz` - ounce
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
>>> 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 @@ -398,11 +401,14 @@
>>> run(args)
Water units list:
<BLANKLINE>
1. `g` - gram
2. `kg` - kilogram
3. `l` - liter
4. `lb` - pound
5. `mg` - milligram
6. `ml` - milliliter
7. `oz` - ounce
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
"""
12 changes: 12 additions & 0 deletions test/verified_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,4 +331,16 @@
True
>>> convert_water(240, "l", True) == 240000.0 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "tbsp") == 16.230719999999998 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "tbsp", True) == 3548.8259300881296 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "tsp") == 48.6912 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "tsp", True) == 1182.9652996845425 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "dsp") == 24.3456 # https://www.howmany.wiki/wv/
True
>>> convert_water(240, "dsp", True) == 2365.930599369085 # https://www.howmany.wiki/wv/
True
"""

0 comments on commit ff6a9a5

Please sign in to comment.