@@ -12,6 +12,8 @@ class TestValidationReport:
12
12
ERROR_2 = ValidationFailure ("bad" ,
13
13
filename = "20201107_county_sig2.csv" ,
14
14
message = "msg 2" )
15
+ WARNING_1 = ValidationFailure ("wrong import" , date = None )
16
+ WARNING_2 = ValidationFailure ("right import" , date = None )
15
17
16
18
def test_add_raised_unsuppressed_error (self ):
17
19
"""Test that an unsupressed error shows up in the unsuppressed error list."""
@@ -36,8 +38,8 @@ def test_str(self):
36
38
report .increment_total_checks ()
37
39
report .increment_total_checks ()
38
40
report .increment_total_checks ()
39
- report .add_raised_warning (ImportWarning ( "wrong import" ) )
40
- report .add_raised_warning (ImportWarning ( "right import" ) )
41
+ report .add_raised_warning (self . WARNING_1 )
42
+ report .add_raised_warning (self . WARNING_2 )
41
43
report .add_raised_error (self .ERROR_1 )
42
44
report .add_raised_error (self .ERROR_2 )
43
45
@@ -48,15 +50,27 @@ def test_log(self):
48
50
report .increment_total_checks ()
49
51
report .increment_total_checks ()
50
52
report .increment_total_checks ()
51
- report .add_raised_warning (ImportWarning ( "wrong import" ) )
52
- report .add_raised_warning (ImportWarning ( "right import" ) )
53
+ report .add_raised_warning (self . WARNING_1 )
54
+ report .add_raised_warning (self . WARNING_2 )
53
55
report .add_raised_error (self .ERROR_1 )
54
56
report .add_raised_error (self .ERROR_2 )
55
57
56
58
report .log (mock_logger )
57
59
mock_logger .critical .assert_called_once_with (
58
60
"bad failed for sig2 at resolution county on 2020-11-07: msg 2" ,
59
- phase = "validation" )
61
+ phase = "validation" , error_name = "bad" ,
62
+ signal = "sig2" , resolution = "county" ,
63
+ date = "2020-11-07" )
60
64
mock_logger .warning .assert_has_calls (
61
- [mock .call ("wrong import" ,phase = "validation" ),
62
- mock .call ("right import" , phase = "validation" )])
65
+ [mock .call ("wrong import failed for None at resolution None on *: " ,
66
+ phase = "validation" ,
67
+ error_name = "wrong import" ,
68
+ signal = None ,
69
+ resolution = None ,
70
+ date = '*' ),
71
+ mock .call ("right import failed for None at resolution None on *: " ,
72
+ phase = "validation" ,
73
+ error_name = "right import" ,
74
+ signal = None ,
75
+ resolution = None ,
76
+ date = '*' )])
0 commit comments