Skip to content

Commit 74fc693

Browse files
committed
BF: test_strategy -- use OS specific os.linesep + shebang
1 parent b4993f3 commit 74fc693

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test_strategy.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
1+
#!/usr/bin/env python
12
"""
23
Tests for strategy.py
34
"""
45

5-
import subprocess, sys
6+
import os
7+
import subprocess
8+
import sys
69

710
if sys.version_info < (2, 7):
811
import unittest2 as unittest
912
else:
1013
import unittest
1114

15+
1216
class StrategyTest(unittest.TestCase):
1317

1418
def test_print_output(self):
@@ -18,9 +22,12 @@ def test_print_output(self):
1822
line when running 'python strategy.py'.
1923
"""
2024
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+
])
2431
# byte representation required due to EOF returned subprocess
2532
expected_output_as_bytes = expected_output.encode(encoding='UTF-8')
2633
self.assertEqual(output, expected_output_as_bytes)

0 commit comments

Comments
 (0)