Skip to content

Commit

Permalink
Spoon (#38)
Browse files Browse the repository at this point in the history
* feat : tablespoon added

* feat : teaspoon added

* feat : dessertspoon added

* fix : tests updated

* doc : CHANGELOG.md updated

* doc : README.md references updated

* fix : tests updated

* doc : minor edit in CHANGELOG.md

* doc : minor edit in README.md references section
  • Loading branch information
sepandhaghighi authored Nov 17, 2024
1 parent bf95ade commit 8bc6479
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 11 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- 1 new coffee unit
- 4 new coffee units
1. Coffee beans (`cb`)
2. Tablespoon (`tbsp`)
3. Teaspoon (`tsp`)
4. Dessertspoon (`dsp`)
- `convert_coffee` function
### Changed
- GitHub actions are limited to the `dev` and `main` branches
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ Just fill an issue and describe it. We'll check it ASAP!
<blockquote>17- <a href="https://www.seattlecoffeegear.com/pages/product-resource/aero-press-product-resources">AeroPress Product User Manuals</a></blockquote>
<blockquote>18- <a href="https://www.rapidtables.com/convert/weight/index.html">RapidTables - Weight Converter</a></blockquote>
<blockquote>19- <a href="https://honestcoffeeguide.com/whole-bean-to-ground-coffee-ratio/">Whole bean to ground coffee calculator</a></blockquote>
<blockquote>20- <a href="https://www.howmany.wiki/wv/">Weight to Volume Converter for Recipes</a></blockquote>
<blockquote>21- <a href="https://chamberlaincoffee.com/blogs/inspiration/how-much-coffee-per-cup-this-is-how-you-get-it-right">How Much Coffee per Cup?</a></blockquote>

## Show Your Support
Expand Down
3 changes: 3 additions & 0 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,7 @@
"mg": {"name": "milligram", "rate": 1000},
"kg": {"name": "kilogram", "rate": 0.001},
"cb": {"name": "coffee beans", "rate": 7.5471698},
"tbsp": {"name": "tablespoon", "rate": 0.18528},
"tsp": {"name": "teaspoon", "rate": 0.55585},
"dsp": {"name": "dessertspoon", "rate": 0.27792},
}
26 changes: 16 additions & 10 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@
Coffee units list:
<BLANKLINE>
1. `cb` - coffee beans
2. `g` - gram
3. `kg` - kilogram
4. `lb` - pound
5. `mg` - milligram
6. `oz` - ounce
2. `dsp` - dessertspoon
3. `g` - gram
4. `kg` - kilogram
5. `lb` - pound
6. `mg` - milligram
7. `oz` - ounce
8. `tbsp` - tablespoon
9. `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 @@ -314,9 +317,12 @@
Coffee units list:
<BLANKLINE>
1. `cb` - coffee beans
2. `g` - gram
3. `kg` - kilogram
4. `lb` - pound
5. `mg` - milligram
6. `oz` - ounce
2. `dsp` - dessertspoon
3. `g` - gram
4. `kg` - kilogram
5. `lb` - pound
6. `mg` - milligram
7. `oz` - ounce
8. `tbsp` - tablespoon
9. `tsp` - teaspoon
"""
12 changes: 12 additions & 0 deletions test/verified_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,16 @@
>>> custom_coffee_cb = calc_coffee(custom_params)
>>> custom_coffee_cb == 107
True
>>> custom_params["coffee_unit"] = "tbsp" # https://www.howmany.wiki/wv/
>>> custom_coffee_tbsp = calc_coffee(custom_params)
>>> custom_coffee_tbsp == 2.6157176470588235
True
>>> custom_params["coffee_unit"] = "tsp" # https://www.howmany.wiki/wv/
>>> custom_coffee_tsp = calc_coffee(custom_params)
>>> custom_coffee_tsp == 7.847294117647058
True
>>> custom_params["coffee_unit"] = "dsp" # https://www.howmany.wiki/wv/
>>> custom_coffee_dsp = calc_coffee(custom_params)
>>> custom_coffee_dsp == 3.923576470588235
True
"""

0 comments on commit 8bc6479

Please sign in to comment.