Skip to content

Commit 84762b4

Browse files
authored
Merge pull request #2379 from nikicc/owcolor-fixup
[FIX] OWColor: Fix propagating changes to the output
2 parents cc063e2 + d3adc47 commit 84762b4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Orange/data/table.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ def match_type(x):
349349
if cached:
350350
return cached
351351
if domain == source.domain:
352-
return cls.from_table_rows(source, row_indices)
352+
table = cls.from_table_rows(source, row_indices)
353+
# assure resulting domain is the instance passed on input
354+
table.domain = domain
355+
return table
353356

354357
if isinstance(row_indices, slice):
355358
start, stop, stride = row_indices.indices(source.X.shape[0])

Orange/tests/test_table.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Test methods with long descriptive names can omit docstrings
22
# pylint: disable=missing-docstring
33

4+
import copy
45
import os
6+
import random
57
import unittest
68
from itertools import chain
79
from math import isnan
8-
import random
9-
1010
from unittest.mock import Mock, MagicMock, patch
11-
import scipy.sparse as sp
11+
1212
import numpy as np
13+
import scipy.sparse as sp
1314

1415
from Orange import data
1516
from Orange.data import (filter, Unknown, Variable, Table, DiscreteVariable,
@@ -1735,6 +1736,12 @@ class MyTableClass(data.Table):
17351736
self.assertIsNot(table, new_table)
17361737
self.assertIs(new_table.domain, new_domain)
17371738

1739+
def test_transform_same_domain(self):
1740+
iris = data.Table("iris")
1741+
new_domain = copy.copy(iris.domain)
1742+
new_data = iris.transform(new_domain)
1743+
self.assertIs(new_data.domain, new_domain)
1744+
17381745
def test_can_copy_table(self):
17391746
new_table = data.Table.from_table(self.domain, self.table)
17401747
self.assert_table_with_filter_matches(new_table, self.table)

0 commit comments

Comments
 (0)