Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] OWColor: Fix propagating changes to the output #2379

Merged
merged 2 commits into from
Jul 10, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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