66import numpy as np
77import scipy .sparse as sp
88
9- import Orange
109from Orange .data import (
1110 ContinuousVariable , DiscreteVariable , StringVariable ,
1211 Domain , Table , IsDefined , FilterContinuous , Values , FilterString ,
@@ -533,10 +532,6 @@ def test_get_column_proper_view(self):
533532 np .testing .assert_equal (col , data .X [:, 0 ])
534533 self .assertIs (col .base , data .X )
535534
536- col = data .get_column (y , view = True )
537- np .testing .assert_equal (col , data .X [:, 0 ])
538- self .assertIs (col .base , data .X )
539-
540535 col = data .get_column (y , copy = True )
541536 np .testing .assert_equal (col , data .X [:, 0 ])
542537 self .assertIsNone (col .base )
@@ -552,31 +547,20 @@ def test_get_column_computed(self):
552547 np .testing .assert_equal (col2 , [2 , 4 , 6 ])
553548 self .assertIsNone (col2 .base )
554549
555- self .assertRaises (ValueError , data .get_column , y2 , view = True )
556-
557- def test_get_column_wrong_arguments (self ):
558- self .assertRaises (
559- ValueError , self .data .get_column , self .data .domain ["y" ],
560- copy = True , view = True )
561-
562550 def test_get_column_discrete (self ):
563551 data , d = self .data , self .data .domain ["d" ]
564552
565553 col = data .get_column (d )
566554 np .testing .assert_equal (col , [0 , 0 , 1 ])
567555 self .assertIs (col .base , data .X )
568556
569- col = data .get_column (d , view = True )
570- np .testing .assert_equal (col , [0 , 0 , 1 ])
571- self .assertIs (col .base , data .X )
572-
573557 col = data .get_column (d , copy = True )
574558 np .testing .assert_equal (col , [0 , 0 , 1 ])
575559 self .assertIsNone (col .base )
576560
577561 e = DiscreteVariable ("d" , values = ("a" , "b" ))
578562 assert e == d
579- col = data .get_column (e , view = True )
563+ col = data .get_column (e )
580564 np .testing .assert_equal (col , [0 , 0 , 1 ])
581565 self .assertIs (col .base , data .X )
582566
@@ -590,10 +574,6 @@ def test_get_column_discrete(self):
590574 col = data .get_column (e )
591575 np .testing .assert_equal (col , [0 , 0 , 2 ])
592576
593- e = DiscreteVariable ("d" , values = ("a" , "b" , "c" ))
594- assert e == d # because that's how Variable mapping works
595- self .assertRaises (ValueError , data .get_column , e , view = True )
596-
597577 with data .unlocked (data .X ):
598578 data .X = sp .csr_matrix (data .X )
599579 e = DiscreteVariable ("d" , values = ("a" , "c" , "b" ))
@@ -612,19 +592,11 @@ def test_sparse(self):
612592 self .assertFalse (sp .issparse (col ))
613593 np .testing .assert_equal (col , orig_y )
614594
615- self .assertRaises (ValueError , data .get_column , y , view = True )
616-
617595 col = data .get_column (y , copy = True )
618596 self .assertFalse (sp .issparse (col ))
619597 np .testing .assert_equal (col , orig_y )
620598
621599 def test_get_column_no_variable (self ):
622- self .assertRaises (ValueError , self .data .get_column ,
623- ContinuousVariable ("y3" ), view = True )
624-
625- self .assertRaises (ValueError , self .data .get_column ,
626- ContinuousVariable ("y3" ), copy = True )
627-
628600 self .assertRaises (ValueError , self .data .get_column ,
629601 ContinuousVariable ("y3" ))
630602
@@ -635,10 +607,6 @@ def test_index_by_int(self):
635607 np .testing .assert_equal (col , data .X [:, 0 ])
636608 self .assertIs (col .base , data .X )
637609
638- col = data .get_column (0 , view = True )
639- np .testing .assert_equal (col , data .X [:, 0 ])
640- self .assertIs (col .base , data .X )
641-
642610 col = data .get_column (0 , copy = True )
643611 np .testing .assert_equal (col , data .X [:, 0 ])
644612 self .assertIsNone (col .base )
@@ -658,10 +626,6 @@ def test_index_by_int(self):
658626 np .testing .assert_equal (col , data .X [:, 0 ])
659627 self .assertIs (col .base , data .X )
660628
661- col = data .get_column ("y" , view = True )
662- np .testing .assert_equal (col , data .X [:, 0 ])
663- self .assertIs (col .base , data .X )
664-
665629 col = data .get_column ("y" , copy = True )
666630 np .testing .assert_equal (col , data .X [:, 0 ])
667631 self .assertIsNone (col .base )
0 commit comments