File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
1
2
"""
2
3
Tests for strategy.py
3
4
"""
4
5
5
- import subprocess , sys
6
+ import os
7
+ import subprocess
8
+ import sys
6
9
7
10
if sys .version_info < (2 , 7 ):
8
11
import unittest2 as unittest
9
12
else :
10
13
import unittest
11
14
15
+
12
16
class StrategyTest (unittest .TestCase ):
13
17
14
18
def test_print_output (self ):
@@ -18,9 +22,12 @@ def test_print_output(self):
18
22
line when running 'python strategy.py'.
19
23
"""
20
24
output = subprocess .check_output (["python" , "strategy.py" ])
21
- expected_output = 'Strategy Example 0\r \n \
22
- Strategy Example 1 from execute 1\r \n \
23
- Strategy Example 2 from execute 2\r \n '
25
+ expected_output = os .linesep .join ([
26
+ 'Strategy Example 0' ,
27
+ 'Strategy Example 1 from execute 1' ,
28
+ 'Strategy Example 2 from execute 2' ,
29
+ ''
30
+ ])
24
31
# byte representation required due to EOF returned subprocess
25
32
expected_output_as_bytes = expected_output .encode (encoding = 'UTF-8' )
26
33
self .assertEqual (output , expected_output_as_bytes )
You can’t perform that action at this time.
0 commit comments