Skip to content

Commit

Permalink
fix : tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
sepandhaghighi committed Oct 12, 2024
1 parent 14538f8 commit 266b2e6
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions test/functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
>>> import argparse
>>> from mycoffee.functions import *
>>> from mycoffee.params import *
>>> test_params = {"method":"v60", "cups":2, "coffee":30, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method"}
>>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method"}
>>> print_result(test_params)
__ __ _ _ ___ _____ ____ ____ ____ ____
( \/ )( \/ ) / __)( _ )( ___)( ___)( ___)( ___)
Expand All @@ -16,15 +16,15 @@
<BLANKLINE>
Cups: 2
<BLANKLINE>
Coffee: 30 gr
Coffee: 60 gr
<BLANKLINE>
Water: 500 gr
<BLANKLINE>
Ratio: 3/50
<BLANKLINE>
Info: V60 method
<BLANKLINE>
>>> test_params = {"method":"v60", "cups":2, "coffee":30, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3}
>>> test_params = {"method":"v60", "cups":2, "coffee":60, "water":500, "coffee_ratio": 3, "water_ratio":50, "info":"", "digits":3}
>>> test_params = filter_params(test_params)
>>> check_ratio_limits(test_params) == True
True
Expand All @@ -40,15 +40,15 @@
<BLANKLINE>
Cups: 2
<BLANKLINE>
Coffee: 30 gr
Coffee: 60 gr
<BLANKLINE>
Water: 500 gr
<BLANKLINE>
Ratio: 3/50
<BLANKLINE>
Info: Nothing :)
<BLANKLINE>
>>> test_params = {"method":"v60", "cups":2, "coffee":3, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3}
>>> test_params = {"method":"v60", "cups":2, "coffee":6.0, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3}
>>> test_params = filter_params(test_params)
>>> check_ratio_limits(test_params) == False
True
Expand All @@ -64,7 +64,7 @@
<BLANKLINE>
Cups: 2
<BLANKLINE>
Coffee: 3 gr
Coffee: 6 gr
<BLANKLINE>
Water: 500 gr
<BLANKLINE>
Expand All @@ -73,7 +73,7 @@
Info: Nothing :)
<BLANKLINE>
[Warning] The ratio is not within the standard range. For `v60`, the ratio can be anywhere between `1/18` and `1/14`
>>> test_params = {"method":"custom", "cups":2, "coffee":3, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3}
>>> test_params = {"method":"custom", "cups":2, "coffee":6.0, "water":500, "coffee_ratio": 6, "water_ratio":1000, "info":"", "digits":3}
>>> test_params = filter_params(test_params)
>>> check_ratio_limits(test_params) == True
True
Expand Down Expand Up @@ -102,13 +102,16 @@
17. `steep-and-release` - Steep-and-release method
18. `turkish` - Turkish method
19. `v60` - V60 method
>>> test_params = {"method":"v60", "cups":2, "coffee":30, "water":335, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method"}
>>> test_params = {"method":"v60", "cups":1, "water":335, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method"}
>>> calc_coffee(test_params)
20.1
>>> test_params = {"method":"v60", "cups":2, "water":335, "coffee_ratio": 3, "water_ratio":50, "info":"V60 method"}
>>> calc_coffee(test_params)
40.2
>>> test_params = {"method":"v60", "cups":2, "coffee":20.0, "water":335.0, "coffee_ratio": 3.0, "water_ratio":50.0, "info":"", "digits":3}
>>> test_params = {"method":"v60", "cups":2, "coffee":40.2, "water":335.0, "coffee_ratio": 3.0, "water_ratio":50.0, "info":"", "digits":3}
>>> test_params = filter_params(test_params)
>>> test_params["coffee"]
20
40.2
>>> test_params["water_ratio"]
50
>>> test_params["coffee_ratio"]
Expand All @@ -117,10 +120,10 @@
335
>>> test_params["info"]
'Nothing :)'
>>> test_params = {"method":"v60", "cups":2, "coffee":20.12345, "water":335.12345, "coffee_ratio": 3.12345, "water_ratio":50.12345, "info":"", "digits":2}
>>> test_params = {"method":"v60", "cups":2, "coffee":41.76653202852158, "water":335.12345, "coffee_ratio": 3.12345, "water_ratio":50.12345, "info":"", "digits":2}
>>> test_params = filter_params(test_params)
>>> test_params["coffee"]
20.12
41.77
>>> test_params["coffee_ratio"]
3.12345
>>> test_params["water_ratio"]
Expand Down Expand Up @@ -212,6 +215,30 @@
15.9
>>> params["digits"]
1
>>> args = parser.parse_args(["--method", 'steep-and-release', "--digits", '1', "--cups", '3'])
>>> params = load_params(args)
>>> params["coffee"] = calc_coffee(params)
>>> params["water"]
255
>>> params["coffee"]
47.8125
>>> params["water_ratio"]
16
>>> params["coffee_ratio"]
1
>>> params["method"]
'steep-and-release'
>>> params = filter_params(params)
>>> params["water_ratio"]
16
>>> params["coffee_ratio"]
1
>>> params["water"]
255
>>> params["coffee"]
47.8
>>> params["digits"]
1
>>> args = parser.parse_args(["--methods-list"])
>>> run(args)
Methods list:
Expand Down

0 comments on commit 266b2e6

Please sign in to comment.