-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
Attributes are used to store colors/origin, which might be different for different datasets, even if the variable is "the same".
2883f1a
to
d63b672
Compare
Codecov Report
@@ 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)) |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
As already done in biolabgh-2667 for other variables.
Issue
gh-1592
Description of changes
make returns proxies
Includes