@@ -58,26 +58,35 @@ def test_get_scaling():
58
58
59
59
# list or tuple tests
60
60
# total_size contains other than Ellipsis, None and Int
61
- with pytest .raises (TypeError ):
61
+ with pytest .raises (TypeError , match = "Unrecognized `total_size` type" ):
62
62
_get_scaling ([2 , 4 , 5 , 9 , 11.5 ], (2 , 3 ), 2 )
63
63
# check with Ellipsis
64
- with pytest .raises (ValueError ):
64
+ with pytest .raises (ValueError , match = "Double Ellipsis in `total_size` is restricted" ):
65
65
_get_scaling ([1 , 2 , 5 , Ellipsis , Ellipsis ], (2 , 3 ), 2 )
66
- with pytest .raises (ValueError ):
66
+ with pytest .raises (
67
+ ValueError ,
68
+ match = "Length of `total_size` is too big, number of scalings is bigger that ndim" ,
69
+ ):
67
70
_get_scaling ([1 , 2 , 5 , Ellipsis ], (2 , 3 ), 2 )
68
71
69
72
assert _get_scaling ([Ellipsis ], (2 , 3 ), 2 ).eval () == 1
70
73
71
74
assert _get_scaling ([4 , 5 , 9 , Ellipsis , 32 , 12 ], (2 , 3 , 2 ), 5 ).eval () == 960
72
75
assert _get_scaling ([4 , 5 , 9 , Ellipsis ], (2 , 3 , 2 ), 5 ).eval () == 15
73
76
# total_size with no Ellipsis (end = [ ])
74
- with pytest .raises (ValueError ):
77
+ with pytest .raises (
78
+ ValueError ,
79
+ match = "Length of `total_size` is too big, number of scalings is bigger that ndim" ,
80
+ ):
75
81
_get_scaling ([1 , 2 , 5 ], (2 , 3 ), 2 )
76
82
77
83
assert _get_scaling ([], (2 , 3 ), 2 ).eval () == 1
78
84
assert _get_scaling ((), (2 , 3 ), 2 ).eval () == 1
79
85
# total_size invalid type
80
- with pytest .raises (TypeError ):
86
+ with pytest .raises (
87
+ TypeError ,
88
+ match = "Unrecognized `total_size` type, expected int or list of ints, got {1, 2, 5}" ,
89
+ ):
81
90
_get_scaling ({1 , 2 , 5 }, (2 , 3 ), 2 )
82
91
83
92
# test with rvar from model graph
0 commit comments