From 901cfb7e66166ed2d803c77c999dc2ed484f8e11 Mon Sep 17 00:00:00 2001 From: Sepand Haghighi Date: Mon, 30 Dec 2024 21:22:27 +0330 Subject: [PATCH] CL (#71) * 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 --- CHANGELOG.md | 5 ++- README.md | 1 + mycoffee/params.py | 1 + test/functions_test.py | 70 ++++++++++++++++++++++-------------------- test/verified_test.py | 4 +++ 5 files changed, 46 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f096fff..c4ca9ac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index 06bdfab..5e976b2 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,7 @@ Just fill an issue and describe it. We'll check it ASAP!
21- How Much Coffee per Cup?
22- Weight Calculator
23- Volume Conversion Calculator - Inch Calculator
+
24- Metric Conversion Charts and Calculators
## Show Your Support diff --git a/mycoffee/params.py b/mycoffee/params.py index dd0273c..e0b6373 100644 --- a/mycoffee/params.py +++ b/mycoffee/params.py @@ -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}, diff --git a/test/functions_test.py b/test/functions_test.py index cc3b9e3..676999e 100644 --- a/test/functions_test.py +++ b/test/functions_test.py @@ -158,23 +158,24 @@ Water units list: 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 @@ -416,21 +417,22 @@ Water units list: 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 """ diff --git a/test/verified_test.py b/test/verified_test.py index d2192c4..48a64e0 100644 --- a/test/verified_test.py +++ b/test/verified_test.py @@ -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 """