@@ -24,6 +24,12 @@ import CategoricalDistributions: classes
24
24
@test_logs ((:warn , r" No " ),
25
25
UnivariateFinite ([' f' , ' q' , ' s' ], [0.7 , 0.2 , 0.1 ]))
26
26
27
+ junk = [" F" , " Q" , " S" ]
28
+ @test_throws (
29
+ CategoricalDistributions. err_incompatible_pool (junk, classes (v)),
30
+ UnivariateFinite (junk, [0.1 , 0.9 ], pool= v),
31
+ )
32
+
27
33
end
28
34
29
35
@testset " array constructors" begin
37
43
38
44
UnivariateFinite (supp, probs, pool= missing , augment= true );
39
45
40
- # construction from pool and support does not
46
+ # construction from pool and support does not
41
47
# consist of categorical elements (See issue #34)
42
48
v = categorical ([" x" , " x" , " y" , " z" , " y" , " z" , " p" ])
43
49
probs1 = [0.1 , 0.2 , 0.7 ]
75
81
v = categorical ([' x' , ' x' , ' y' , ' x' , ' z' , ' w' ])
76
82
probs_fillarray = FillArrays. Ones (100 , 3 )
77
83
probs_array = ones (100 , 3 )
78
-
84
+
79
85
probs1_fillarray = FillArrays. Fill (0.2 , 100 , 2 )
80
86
probs1_array = fill (0.2 , 100 , 2 )
81
87
88
94
u1_from_fillarray = UnivariateFinite (
89
95
[' x' , ' y' , ' z' ], probs1_fillarray, pool= v, augment= true
90
96
)
91
-
97
+
92
98
@test u_from_array. prob_given_ref == u_from_fillarray. prob_given_ref
93
99
@test u1_from_array. prob_given_ref == u1_from_fillarray. prob_given_ref
94
100
0 commit comments