Commits

astaric  committed 0140e34

Fixed some failing tests.

  • Participants
  • Parent commits e6b67af

Comments (0)

Files changed (2)

File Orange/data/table.py

             s = len(self.domain.variables)
             start, end, stride = col_idx.indices(s)
             if col_idx.indices(s) == (0, s, 1):
-                return None, self.col_indices
+                return None, None
             else:
                 return self.domain.attributes[col_idx], \
-                       self.arange(start, end, stride)
+                       np.arange(start, end, stride)
         elif isinstance(col_idx, Iterable) and not isinstance(col_idx, str):
             attributes = [self.domain[col] for col in col_idx]
             if attributes == self.domain.attributes:
-                return None, self.col_indices
+                return None, None
             return attributes, np.fromiter(
                 (self.domain.index(attr) for attr in attributes), int)
         else:
 
         # multiple rows OR single row but multiple columns: construct a new table
         attributes, col_indices = self._compute_col_indices(col_idx)
-        n_attrs = len(self.domain.attributes)
-        r_attrs = [attributes[i] for i, col in enumerate(col_indices) if 0 <= col < n_attrs]
-        r_classes = [attributes[i] for i, col in enumerate(col_indices) if col >= n_attrs]
-        r_metas = [attributes[i] for i, col in enumerate(col_indices) if col < 0]
         if attributes is not None:
+            n_attrs = len(self.domain.attributes)
+            r_attrs = [attributes[i] for i, col in enumerate(col_indices) if 0 <= col < n_attrs]
+            r_classes = [attributes[i] for i, col in enumerate(col_indices) if col >= n_attrs]
+            r_metas = [attributes[i] for i, col in enumerate(col_indices) if col < 0]
             domain = Domain(r_attrs, r_classes)
             domain.metas = r_metas
         else:

File Orange/tests/test_table.py

                 value = self.table[r][c]
                 self.assertAlmostEqual(value, magic_table[r,c])
 
-                value = self.table[r, :][c]
-                self.assertAlmostEqual(value, magic_table[r,c])
-
 
     def test_can_select_a_single_row(self):
         for r in (0, -1):