@@ -710,47 +710,32 @@ def test_ktensor_normalize(sample_ktensor_2way, sample_ktensor_3way):
710710def test_ktensor_nvecs (sample_ktensor_3way ):
711711 (data , K ) = sample_ktensor_3way
712712
713- with pytest .warns (Warning ) as record :
714- assert np .allclose (
715- K .nvecs (0 , 1 ), np .array ([[0.5731077440321353 ], [0.8194800264377384 ]])
716- )
717- assert (
718- "Greater than or equal to ktensor.shape[n] - 1 eigenvectors requires cast to dense to solve"
719- in str (record [0 ].message )
713+ assert np .allclose (
714+ K .nvecs (0 , 1 ), np .array ([[0.5731077440321353 ], [0.8194800264377384 ]])
720715 )
721- with pytest .warns (Warning ) as record :
722- assert np .allclose (
723- K .nvecs (0 , 2 ),
724- np .array (
725- [
726- [0.5731077440321353 , 0.8194800264377384 ],
727- [0.8194800264377384 , - 0.5731077440321353 ],
728- ]
729- ),
730- )
731- assert (
732- "Greater than or equal to ktensor.shape[n] - 1 eigenvectors requires cast to dense to solve"
733- in str (record [0 ].message )
716+ assert np .allclose (
717+ K .nvecs (0 , 2 ),
718+ np .array (
719+ [
720+ [0.5731077440321353 , 0.8194800264377384 ],
721+ [0.8194800264377384 , - 0.5731077440321353 ],
722+ ]
723+ ),
734724 )
735725
736726 assert np .allclose (
737727 K .nvecs (1 , 1 ),
738728 np .array ([[0.5048631426517823 ], [0.5745404391632514 ], [0.6442177356747206 ]]),
739729 )
740- with pytest .warns (Warning ) as record :
741- assert np .allclose (
742- K .nvecs (1 , 2 ),
743- np .array (
744- [
745- [0.5048631426517821 , 0.7605567306550753 ],
746- [0.5745404391632517 , 0.0568912743440822 ],
747- [0.6442177356747206 , - 0.6467741818894517 ],
748- ]
749- ),
750- )
751- assert (
752- "Greater than or equal to ktensor.shape[n] - 1 eigenvectors requires cast to dense to solve"
753- in str (record [0 ].message )
730+ assert np .allclose (
731+ K .nvecs (1 , 2 ),
732+ np .array (
733+ [
734+ [0.5048631426517821 , 0.7605567306550753 ],
735+ [0.5745404391632517 , 0.0568912743440822 ],
736+ [0.6442177356747206 , - 0.6467741818894517 ],
737+ ]
738+ ),
754739 )
755740
756741 assert np .allclose (
@@ -777,12 +762,7 @@ def test_ktensor_nvecs(sample_ktensor_3way):
777762 )
778763
779764 # Test for r >= N-1, requires cast to dense
780- with pytest .warns (Warning ) as record :
781- K .nvecs (1 , 3 )
782- assert (
783- "Greater than or equal to ktensor.shape[n] - 1 eigenvectors requires cast to dense to solve"
784- in str (record [0 ].message )
785- )
765+ K .nvecs (1 , 3 )
786766
787767
788768@pytest .mark .indevelopment
0 commit comments