@@ -90,9 +90,9 @@ def test_gen_smat_sim (ind, form, sep, dim_size, mn, sd, incl, diff, seed):
90
90
_smat = xr .open_dataarray (_smat )
91
91
smat = pm .gen_smat_sim (infl , form , sep , dim_size , mn , sd , incl , diff , seed )
92
92
if seed is None :
93
- assert not smat .identical (_smat )
93
+ assert not smat .round ( 10 ). identical (_smat . round ( 10 ) )
94
94
else :
95
- assert smat . identical ( _smat )
95
+ xr . testing . assert_allclose ( smat , _smat )
96
96
97
97
98
98
def test_gen_fmat ():
@@ -101,15 +101,15 @@ def test_gen_fmat():
101
101
fmat = pm .gen_fmat (cmat , smat )
102
102
_fmat = '{}/fmat.nc' .format (RESOURCES )
103
103
_fmat = xr .open_dataarray (_fmat )
104
- assert fmat . identical ( _fmat )
104
+ xr . testing . assert_allclose ( fmat , _fmat )
105
105
106
106
def test_gen_gmat ():
107
107
cmat = pm .gen_cmat (infl .word , gram = 3 , count = False , noise = 0 )
108
108
smat = pm .gen_smat_sim (infl , form = 'word' , sep = '/' , dim_size = 5 , seed = 10 )
109
109
gmat = pm .gen_gmat (cmat , smat )
110
110
_gmat = '{}/gmat.nc' .format (RESOURCES )
111
111
_gmat = xr .open_dataarray (_gmat )
112
- assert gmat . identical ( _gmat )
112
+ xr . testing . assert_allclose ( gmat , _gmat )
113
113
114
114
cmat = pm .gen_cmat (infl .word , gram = 3 , count = False , noise = 0 )
115
115
smat = pm .gen_smat_sim (infl , form = 'word' , sep = '/' , dim_size = 5 , seed = 10 )
@@ -133,7 +133,7 @@ def test_gen_shat (ind, cmat, fmat, smat, hmat):
133
133
if ind == 3 : # Rounding due to rounding errors when producing hmat.
134
134
shat = shat .round (10 )
135
135
_shat = _shat .round (10 )
136
- assert shat . identical ( _shat )
136
+ xr . testing . assert_allclose ( shat , _shat )
137
137
138
138
139
139
gmat = pm .gen_gmat (cmat , smat )
@@ -156,7 +156,7 @@ def test_gen_chat (ind, smat, gmat, cmat, hmat):
156
156
if ind == 3 : # Rounding due to rounding errors when producing hmat.
157
157
chat = chat .round (10 )
158
158
_chat = _chat .round (10 )
159
- assert chat . identical ( _chat )
159
+ xr . testing . assert_allclose ( chat , _chat )
160
160
161
161
def test_update_weight_matrix ():
162
162
w = np .zeros ((4 ,2 ))
@@ -215,7 +215,7 @@ def test_incremental_learning_byind01 ():
215
215
fmat0_cues_values = ['#a' , 'a#' , 'an' , 'n#' ]
216
216
fmat0_feature_values = ['Word:a' , 'Word:an' ]
217
217
fmat0 = xr .DataArray (np .array (fmat0_values ).reshape (fmat0_shape ), dims = fmat0_dims , coords = {'cues' :fmat0_cues_values , 'feature' :fmat0_feature_values })
218
- assert fmat_test . identical ( fmat0 )
218
+ xr . testing . assert_allclose ( fmat_test , fmat0 )
219
219
220
220
def test_incremental_learning_byind02 ():
221
221
cmat = pm .gen_cmat (['a' ,'an' ], gram = 2 )
0 commit comments