Skip to content

Commit

Permalink
Merge pull request #2379 from nikicc/owcolor-fixup
Browse files Browse the repository at this point in the history
[FIX] OWColor: Fix propagating changes to the output
  • Loading branch information
astaric authored Jul 10, 2017
2 parents cc063e2 + d3adc47 commit 84762b4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Orange/data/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,10 @@ def match_type(x):
if cached:
return cached
if domain == source.domain:
return cls.from_table_rows(source, row_indices)
table = cls.from_table_rows(source, row_indices)
# assure resulting domain is the instance passed on input
table.domain = domain
return table

if isinstance(row_indices, slice):
start, stop, stride = row_indices.indices(source.X.shape[0])
Expand Down
13 changes: 10 additions & 3 deletions Orange/tests/test_table.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring

import copy
import os
import random
import unittest
from itertools import chain
from math import isnan
import random

from unittest.mock import Mock, MagicMock, patch
import scipy.sparse as sp

import numpy as np
import scipy.sparse as sp

from Orange import data
from Orange.data import (filter, Unknown, Variable, Table, DiscreteVariable,
Expand Down Expand Up @@ -1735,6 +1736,12 @@ class MyTableClass(data.Table):
self.assertIsNot(table, new_table)
self.assertIs(new_table.domain, new_domain)

def test_transform_same_domain(self):
iris = data.Table("iris")
new_domain = copy.copy(iris.domain)
new_data = iris.transform(new_domain)
self.assertIs(new_data.domain, new_domain)

def test_can_copy_table(self):
new_table = data.Table.from_table(self.domain, self.table)
self.assert_table_with_filter_matches(new_table, self.table)
Expand Down

0 comments on commit 84762b4

Please sign in to comment.