@@ -1669,6 +1669,100 @@ def test_validation_actions_local_all(tbl_type, capsys):
16691669 assert "W_local" in captured .out
16701670
16711671
1672+ @pytest .mark .parametrize ("tbl_type" , ["pandas" , "polars" , "duckdb" ])
1673+ def test_validation_actions_default_global (tbl_type , capsys ):
1674+ (
1675+ Validate (
1676+ data = load_dataset (dataset = "small_table" , tbl_type = tbl_type ),
1677+ thresholds = Thresholds (warning = 1 , error = 2 , critical = 3 ),
1678+ actions = Actions (default = "{level} default_action" , highest_only = False ),
1679+ )
1680+ .col_vals_gt (columns = "d" , value = 10000 )
1681+ .interrogate ()
1682+ )
1683+
1684+ # Capture the output and verify that all three level messages are printed to the console
1685+ captured = capsys .readouterr ()
1686+ assert "critical default_action" in captured .out
1687+ assert "error default_action" in captured .out
1688+ assert "warning default_action" in captured .out
1689+
1690+
1691+ @pytest .mark .parametrize ("tbl_type" , ["pandas" , "polars" , "duckdb" ])
1692+ def test_validation_actions_default_global_override (tbl_type , capsys ):
1693+ (
1694+ Validate (
1695+ data = load_dataset (dataset = "small_table" , tbl_type = tbl_type ),
1696+ thresholds = Thresholds (warning = 1 , error = 2 , critical = 3 ),
1697+ actions = Actions (
1698+ warning = "warning override" , default = "{level} default_action" , highest_only = False
1699+ ),
1700+ )
1701+ .col_vals_gt (columns = "d" , value = 10000 )
1702+ .interrogate ()
1703+ )
1704+
1705+ # Capture the output and verify that all three level messages are printed to the console
1706+ captured = capsys .readouterr ()
1707+ assert "critical default_action" in captured .out
1708+ assert "error default_action" in captured .out
1709+ assert "warning override" in captured .out
1710+
1711+
1712+ @pytest .mark .parametrize ("tbl_type" , ["pandas" , "polars" , "duckdb" ])
1713+ def test_validation_actions_default_local (tbl_type , capsys ):
1714+ (
1715+ Validate (
1716+ data = load_dataset (dataset = "small_table" , tbl_type = tbl_type ),
1717+ thresholds = Thresholds (warning = 1 , error = 2 , critical = 3 ),
1718+ actions = Actions (default = "{level} default_action_global" , highest_only = False ),
1719+ )
1720+ .col_vals_gt (
1721+ columns = "d" ,
1722+ value = 10000 ,
1723+ actions = Actions (default = "{level} default_action_local" , highest_only = False ),
1724+ )
1725+ .interrogate ()
1726+ )
1727+
1728+ # Capture the output and verify that all three level messages are printed to the console
1729+ captured = capsys .readouterr ()
1730+ assert "critical default_action_local" in captured .out
1731+ assert "error default_action_local" in captured .out
1732+ assert "warning default_action_local" in captured .out
1733+
1734+
1735+ @pytest .mark .parametrize ("tbl_type" , ["pandas" , "polars" , "duckdb" ])
1736+ def test_validation_actions_default_local_override (tbl_type , capsys ):
1737+ (
1738+ Validate (
1739+ data = load_dataset (dataset = "small_table" , tbl_type = tbl_type ),
1740+ thresholds = Thresholds (warning = 1 , error = 2 , critical = 3 ),
1741+ actions = Actions (
1742+ warning = "warning override_global" ,
1743+ default = "{level} default_action_global" ,
1744+ highest_only = False ,
1745+ ),
1746+ )
1747+ .col_vals_gt (
1748+ columns = "d" ,
1749+ value = 10000 ,
1750+ actions = Actions (
1751+ warning = "warning override_local" ,
1752+ default = "{level} default_action_local" ,
1753+ highest_only = False ,
1754+ ),
1755+ )
1756+ .interrogate ()
1757+ )
1758+
1759+ # Capture the output and verify that all three level messages are printed to the console
1760+ captured = capsys .readouterr ()
1761+ assert "critical default_action_local" in captured .out
1762+ assert "error default_action_local" in captured .out
1763+ assert "warning override_local" in captured .out
1764+
1765+
16721766@pytest .mark .parametrize ("tbl_type" , ["pandas" , "polars" , "duckdb" ])
16731767def test_validation_actions_get_action_metadata (tbl_type , capsys ):
16741768 def log_issue ():
0 commit comments