@@ -38,6 +38,44 @@ def col_kwargs(dtype, char_size=None, numeric_precision=0, numeric_scale=0):
3838 # String family change (VARCHAR -> NVARCHAR) is only allowed when the
3939 # feature flag is set and capacity is sufficient
4040 (col_kwargs ("varchar" , char_size = 10 ), col_kwargs ("nvarchar" , char_size = 10 ), True , False ),
41+ # Fixed-money types (MONEY/SMALLMONEY) behaviour
42+ # SMALLMONEY -> MONEY (widening) requires the feature flag
43+ (
44+ col_kwargs ("smallmoney" , numeric_precision = 10 , numeric_scale = 4 ),
45+ col_kwargs ("money" , numeric_precision = 19 , numeric_scale = 4 ),
46+ True ,
47+ False ,
48+ ),
49+ # MONEY -> NUMERIC with larger precision/scale should be allowed
50+ (
51+ col_kwargs ("money" , numeric_precision = 19 , numeric_scale = 4 ),
52+ col_kwargs ("numeric" , numeric_precision = 20 , numeric_scale = 4 ),
53+ True ,
54+ False ,
55+ ),
56+ # SMALLMONEY -> NUMERIC with larger precision/scale should be allowed
57+ (
58+ col_kwargs ("smallmoney" , numeric_precision = 10 , numeric_scale = 4 ),
59+ col_kwargs ("numeric" , numeric_precision = 20 , numeric_scale = 4 ),
60+ True ,
61+ False ,
62+ ),
63+ # Equal precision/scale between MONEY and NUMERIC is considered an
64+ # expansion when the dtype changes (money -> numeric) under the
65+ # feature flag
66+ (
67+ col_kwargs ("money" , numeric_precision = 19 , numeric_scale = 4 ),
68+ col_kwargs ("numeric" , numeric_precision = 19 , numeric_scale = 4 ),
69+ True ,
70+ False ,
71+ ),
72+ # NUMERIC -> MONEY that would shrink precision should not be allowed
73+ (
74+ col_kwargs ("numeric" , numeric_precision = 20 , numeric_scale = 4 ),
75+ col_kwargs ("money" , numeric_precision = 19 , numeric_scale = 4 ),
76+ False ,
77+ False ,
78+ ),
4179 ],
4280)
4381def test_can_expand_parametrized (src_kwargs , tgt_kwargs , expect_with_flag , expect_without_flag ):
0 commit comments