Skip to content

Commit

Permalink
CL (#71)
Browse files Browse the repository at this point in the history
* fix : WATER_UNITS_MAP updated

* fix : functions_test.py updated

* fix : verified_test.py updated

* doc : CHANGELOG.md updated

* doc : README.md references section updated

* doc : CHANGELOG.md updated
  • Loading branch information
sepandhaghighi authored Dec 30, 2024
1 parent ca71693 commit 901cfb7
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 35 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]
### Added
- 4 new water units
- 5 new water units
1. Troy Ounce (`t oz`)
2. Grain (`gr`)
3. Carats (`ct`)
4. Cubic Centimeters (`cc`)
5. Centiliters (`cl`)
- 3 new coffee units
1. Troy Ounce (`t oz`)
2. Grain (`gr`)
3. Carats (`ct`)
### Changed
- `README.md` updated
## [1.0] - 2024-12-17
### Added
- 3 new water units
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ Just fill an issue and describe it. We'll check it ASAP!
<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>
<blockquote>22- <a href="https://www.calculator.net/weight-calculator.html">Weight Calculator</a></blockquote>
<blockquote>23- <a href="https://www.inchcalculator.com/convert/volume/">Volume Conversion Calculator - Inch Calculator</a></blockquote>
<blockquote>24- <a href="https://www.metric-conversions.org/">Metric Conversion Charts and Calculators</a></blockquote>

## Show Your Support
Expand Down
1 change: 1 addition & 0 deletions mycoffee/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@
"g": {"name": "gram", "rate": 1},
"ml": {"name": "milliliter", "rate": 1},
"cc": {"name": "cubic centimeter", "rate": 1},
"cl": {"name": "centiliter", "rate": 0.1},
"l": {"name": "liter", "rate": 0.001},
"oz": {"name": "ounce", "rate": 0.03527396195},
"lb": {"name": "pound", "rate": 0.00220462262185},
Expand Down
70 changes: 36 additions & 34 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,23 +158,24 @@
Water units list:
<BLANKLINE>
1. `cc` - cubic centimeter
2. `ct` - carat
3. `cup` - cup
4. `dsp` - dessertspoon
5. `fl oz` - fluid ounce
6. `g` - gram
7. `gr` - grain
8. `kg` - kilogram
9. `l` - liter
10. `lb` - pound
11. `mg` - milligram
12. `ml` - milliliter
13. `oz` - ounce
14. `pt` - pint
15. `qt` - quart
16. `t oz` - troy ounce
17. `tbsp` - tablespoon
18. `tsp` - teaspoon
2. `cl` - centiliter
3. `ct` - carat
4. `cup` - cup
5. `dsp` - dessertspoon
6. `fl oz` - fluid ounce
7. `g` - gram
8. `gr` - grain
9. `kg` - kilogram
10. `l` - liter
11. `lb` - pound
12. `mg` - milligram
13. `ml` - milliliter
14. `oz` - ounce
15. `pt` - pint
16. `qt` - quart
17. `t oz` - troy ounce
18. `tbsp` - tablespoon
19. `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 @@ -416,21 +417,22 @@
Water units list:
<BLANKLINE>
1. `cc` - cubic centimeter
2. `ct` - carat
3. `cup` - cup
4. `dsp` - dessertspoon
5. `fl oz` - fluid ounce
6. `g` - gram
7. `gr` - grain
8. `kg` - kilogram
9. `l` - liter
10. `lb` - pound
11. `mg` - milligram
12. `ml` - milliliter
13. `oz` - ounce
14. `pt` - pint
15. `qt` - quart
16. `t oz` - troy ounce
17. `tbsp` - tablespoon
18. `tsp` - teaspoon
2. `cl` - centiliter
3. `ct` - carat
4. `cup` - cup
5. `dsp` - dessertspoon
6. `fl oz` - fluid ounce
7. `g` - gram
8. `gr` - grain
9. `kg` - kilogram
10. `l` - liter
11. `lb` - pound
12. `mg` - milligram
13. `ml` - milliliter
14. `oz` - ounce
15. `pt` - pint
16. `qt` - quart
17. `t oz` - troy ounce
18. `tbsp` - tablespoon
19. `tsp` - teaspoon
"""
4 changes: 4 additions & 0 deletions test/verified_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,8 @@
True
>>> round(convert_water(240, "cc", True), 1) == 240.0 # https://www.metric-conversions.org/volume/cubic-centimeters-to-milliliters.htm
True
>>> round(convert_water(240, "cl"), 1) == 24.0 # https://www.metric-conversions.org/volume/milliliters-to-centiliters.htm
True
>>> round(convert_water(240, "cl", True), 1) == 2400.0 # https://www.metric-conversions.org/volume/centiliters-to-milliliters.htm
True
"""

0 comments on commit 901cfb7

Please sign in to comment.