def test_show_civisml_warnings_error(): # If the warnings-parser fails, we should still get a sensible warning. warn_list = ["/path UserWarning: A message\n"] # Malformed warning message with pytest.warns(RuntimeWarning) as warns: _model._show_civisml_warnings(warn_list) assert len(warns.list) == 1 assert warn_list[0] in str(warns.list[0].message) assert "Remote warning from CivisML" in str(warns.list[0].message)
def test_show_civisml_warnings(): warn_list = ["/path:13: UserWarning: A message\n", "/module:42: RuntimeWarning: Profundity\n"] with pytest.warns(UserWarning) as warns: _model._show_civisml_warnings(warn_list) assert len(warns.list) == 2 assert str(warns.list[0].message) == "A message" assert str(warns.list[1].message) == "Profundity"