@@ -1085,6 +1085,13 @@ def open_file_and_wait_for_diagnostics(
1085
1085
)
1086
1086
return self .wait_for_diagnostics (solc_process )
1087
1087
1088
+ def expect_report (self , published_diagnostics , uri ):
1089
+ for report in published_diagnostics :
1090
+ if report ['uri' ] == uri :
1091
+ return report
1092
+ self .expect_true (False , f"expected ${ uri } in published_diagnostics" )
1093
+ return None
1094
+
1088
1095
def expect_true (
1089
1096
self ,
1090
1097
actual ,
@@ -1567,16 +1574,14 @@ def test_remapping(self, solc: JsonRpcProcess) -> None:
1567
1574
published_diagnostics = self .wait_for_diagnostics (solc )
1568
1575
self .expect_equal (len (published_diagnostics ), 2 , "expected reports for two files" )
1569
1576
1570
- report = published_diagnostics [0 ]
1571
- self .expect_equal (report ['uri' ], f"{ self .project_root_uri } /other-include-dir/otherlib/otherlib.sol" )
1577
+ report = self .expect_report (published_diagnostics , file_with_remapped_import_uri )
1572
1578
diagnostics = report ['diagnostics' ]
1573
- self .expect_equal (len (diagnostics ), 1 , "no diagnostics" )
1574
- self .expect_diagnostic (diagnostics [0 ], code = 2018 , lineNo = 5 , startEndColumns = (4 , 62 ))
1579
+ self .expect_equal (len (diagnostics ), 0 , "no diagnostics" )
1575
1580
1576
- report = published_diagnostics [1 ]
1577
- self .expect_equal (report ['uri' ], file_with_remapped_import_uri )
1581
+ report = self .expect_report (published_diagnostics , f"{ self .project_root_uri } /other-include-dir/otherlib/otherlib.sol" )
1578
1582
diagnostics = report ['diagnostics' ]
1579
- self .expect_equal (len (diagnostics ), 0 , "no diagnostics" )
1583
+ self .expect_equal (len (diagnostics ), 1 , "no diagnostics" )
1584
+ self .expect_diagnostic (diagnostics [0 ], code = 2018 , lineNo = 5 , startEndColumns = (4 , 62 ))
1580
1585
1581
1586
def test_custom_includes_with_full_project (self , solc : JsonRpcProcess ) -> None :
1582
1587
"""
0 commit comments