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] Variable.make returns proxies #2667

Merged
merged 6 commits into from
Oct 13, 2017
Merged

Conversation

astaric
Copy link
Member

@astaric astaric commented Oct 10, 2017

Issue

gh-1592

Description of changes

make returns proxies

Includes
  • Code changes
  • Tests
  • Documentation

Attributes are used to store colors/origin, which might be different for
different datasets, even if the variable is "the same".
@astaric astaric force-pushed the proxy-origin branch 2 times, most recently from 2883f1a to d63b672 Compare October 10, 2017 20:06
@codecov-io
Copy link

codecov-io commented Oct 10, 2017

Codecov Report

Merging #2667 into master will increase coverage by 0.13%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #2667      +/-   ##
==========================================
+ Coverage   75.52%   75.66%   +0.13%     
==========================================
  Files         332      333       +1     
  Lines       58040    58357     +317     
==========================================
+ Hits        43834    44155     +321     
+ Misses      14206    14202       -4

Since variable proxies were introduced in 94832f2, variables can be
equal without being the same variable.
The old implementation allowed Variable instances which were equal to
have different hash.
Fixes a bug when different Tables would share the origin attribute of
the features, even though the datasets were loaded from separate
folders.
@@ -441,6 +443,8 @@ def test_make_proxy_disc(self):
self.assertEqual(abc, abc1)
self.assertEqual(abc, abc2)
self.assertEqual(abc1, abc2)
self.assertEqual(hash(abc), hash(abc1))
self.assertEqual(hash(abc1), hash(abc2))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a test for non-equal hashes? I can imagine a scenario in which we mess the code so that all variables have the same hash. :)


self.assertEqual(image.attributes["origin"], "a")
self.assertEqual(image1.attributes["origin"], "b")
self.assertEqual(image2.attributes["origin"], "c")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also add a simpler and more explicit test self.assertIsNot(image.attributes, image1.attributes), and same for the other pairs.

@janezd janezd merged commit 9be9bde into biolab:master Oct 13, 2017
ales-erjavec added a commit to ales-erjavec/orange3 that referenced this pull request Sep 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants