Coverage for tests/test_values.py: 100%

17 statements  

« prev     ^ index     » next       coverage.py v6.5.0, created at 2024-02-21 22:00 +0100

1from pysource_minimize import minimize 

2 

3 

4def test_find_bug_in_string(): 

5 assert ( 

6 eval(minimize("print('some bug here')", lambda source: "bug" in source)) 

7 == "bug" 

8 ) 

9 

10 

11def test_minimize_int(): 

12 def contains_bug(source): 

13 try: 

14 return eval(source) > 70 

15 except SyntaxError: 

16 return False 

17 

18 assert eval(minimize("100", contains_bug)) == 71 

19 

20 

21def test_minimize_fload(): 

22 def contains_bug(source): 

23 try: 

24 return eval(source) > 70.0 

25 except SyntaxError: 

26 return False 

27 

28 assert 70 <= eval(minimize("100.0", contains_bug)) <= 70.1