Skip to content

Commit cc516b2

Browse files
committed
Replace docstrings with normal strings in python unit tests to get same line endings on all platforms
1 parent ba6acae commit cc516b2

1 file changed

Lines changed: 25 additions & 28 deletions

File tree

test/scripts/test_bytecodecompare_prepare_report.py

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import json
44
import unittest
55
from pathlib import Path
6-
from textwrap import dedent
76

87
from unittest_helpers import LIBSOLIDITY_TEST_DIR, load_fixture, load_libsolidity_test_case
98

@@ -51,23 +50,21 @@ def test_format_report(self):
5150
]
5251
)
5352

54-
expected_output = dedent("""\
55-
syntaxTests/scoping/library_inherited2.sol:A <NO BYTECODE>
56-
syntaxTests/scoping/library_inherited2.sol:A <NO METADATA>
57-
syntaxTests/scoping/library_inherited2.sol:B <NO BYTECODE>
58-
syntaxTests/scoping/library_inherited2.sol:B {"language":"Solidity"}
59-
syntaxTests/scoping/library_inherited2.sol:Lib 60566050600b828282398051
60-
syntaxTests/scoping/library_inherited2.sol:Lib <NO METADATA>
61-
""")
53+
expected_output = (
54+
"syntaxTests/scoping/library_inherited2.sol:A <NO BYTECODE>\n"
55+
"syntaxTests/scoping/library_inherited2.sol:A <NO METADATA>\n"
56+
"syntaxTests/scoping/library_inherited2.sol:B <NO BYTECODE>\n"
57+
"syntaxTests/scoping/library_inherited2.sol:B {\"language\":\"Solidity\"}\n"
58+
"syntaxTests/scoping/library_inherited2.sol:Lib 60566050600b828282398051\n"
59+
"syntaxTests/scoping/library_inherited2.sol:Lib <NO METADATA>\n"
60+
)
6261

6362
self.assertEqual(report.format_report(), expected_output)
6463

6564
def test_format_report_should_print_error_if_contract_report_list_is_missing(self):
6665
report = FileReport(file_name=Path('file.sol'), contract_reports=None)
6766

68-
expected_output = dedent("""\
69-
file.sol: <ERROR>
70-
""")
67+
expected_output = "file.sol: <ERROR>\n"
7168

7269
self.assertEqual(report.format_report(), expected_output)
7370

@@ -158,28 +155,28 @@ def test_parse_standard_json_output_should_report_error_if_contracts_is_empty(se
158155
self.assertEqual(parse_standard_json_output(Path('contract.sol'), compiler_output), expected_report)
159156

160157
def test_parse_standard_json_output_should_report_error_if_every_file_has_no_contracts(self):
161-
compiler_output = dedent("""\
162-
{
163-
"contracts": {
164-
"contract1.sol": {},
165-
"contract2.sol": {}
166-
}
167-
}
168-
""")
158+
compiler_output = (
159+
"{\n"
160+
" \"contracts\": {\n"
161+
" \"contract1.sol\": {},\n"
162+
" \"contract2.sol\": {}\n"
163+
" }\n"
164+
"}\n"
165+
)
169166

170167
expected_report = FileReport(file_name=Path('contract.sol'), contract_reports=None)
171168

172169
self.assertEqual(parse_standard_json_output(Path('contract.sol'), compiler_output), expected_report)
173170

174171
def test_parse_standard_json_output_should_not_report_error_if_there_is_at_least_one_file_with_contracts(self):
175-
compiler_output = dedent("""\
176-
{
177-
"contracts": {
178-
"contract1.sol": {"A": {}},
179-
"contract2.sol": {}
180-
}
181-
}
182-
""")
172+
compiler_output = (
173+
"{\n"
174+
" \"contracts\": {\n"
175+
" \"contract1.sol\": {\"A\": {}},\n"
176+
" \"contract2.sol\": {}\n"
177+
" }\n"
178+
"}\n"
179+
)
183180

184181
expected_report = FileReport(
185182
file_name=Path('contract.sol'),

0 commit comments

Comments
 (0)