|
18 | 18 | def test_pos(resource, capsys):
|
19 | 19 | main(resource('pos.txt'))
|
20 | 20 | out, err = capsys.readouterr()
|
21 |
| - polarity = re.search('polarity of (.+?) with', out) |
22 |
| - magnitude = re.search('magnitude of (.+?)', out) |
| 21 | + polarity = float(re.search('polarity of (.+?) with', out).group(1)) |
| 22 | + magnitude = float(re.search('magnitude of (.+?)', out).group(1)) |
23 | 23 | assert polarity * magnitude > 0
|
24 | 24 |
|
25 | 25 |
|
26 | 26 | def test_neg(resource, capsys):
|
27 | 27 | main(resource('neg.txt'))
|
28 | 28 | out, err = capsys.readouterr()
|
29 |
| - polarity = re.search('polarity of (.+?) with', out) |
30 |
| - magnitude = re.search('magnitude of (.+?)', out) |
| 29 | + polarity = float(re.search('polarity of (.+?) with', out).group(1)) |
| 30 | + magnitude = float(re.search('magnitude of (.+?)', out).group(1)) |
31 | 31 | assert polarity * magnitude < 0
|
32 | 32 |
|
33 | 33 |
|
34 | 34 | def test_mixed(resource, capsys):
|
35 | 35 | main(resource('mixed.txt'))
|
36 | 36 | out, err = capsys.readouterr()
|
37 |
| - polarity = re.search('polarity of (.+?) with', out) |
38 |
| - assert polarity <= 0.3 is True |
39 |
| - assert polarity >= -0.3 is True |
| 37 | + polarity = float(re.search('polarity of (.+?) with', out).group(1)) |
| 38 | + assert polarity <= 0.3 |
| 39 | + assert polarity >= -0.3 |
40 | 40 |
|
41 | 41 |
|
42 | 42 | def test_neutral(resource, capsys):
|
43 | 43 | main(resource('neutral.txt'))
|
44 | 44 | out, err = capsys.readouterr()
|
45 |
| - magnitude = re.search('magnitude of (.+?)', out) |
46 |
| - assert magnitude <= 2.0 is True |
| 45 | + magnitude = float(re.search('magnitude of (.+?)', out).group(1)) |
| 46 | + assert magnitude <= 2.0 |
0 commit comments