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: Fix Variable.copy for StringVariable and TimeVariable #1589

Merged
merged 1 commit into from
Sep 23, 2016

Conversation

ales-erjavec
Copy link
Contributor

Due to static constructors in Variable.copy and ContinuousVariable.copy
the StringVariable.copy and TimeVariable.copy used to return Variable
and ContinuousVariable instances respectively.

Fix this by dispatching on type(self).

Also add the missing entry for vartype(Variable) in
gui.attributeIconDict

@codecov-io
Copy link

codecov-io commented Sep 23, 2016

Current coverage is 88.66% (diff: 100%)

Merging #1589 into master will increase coverage by <.01%

@@             master      #1589   diff @@
==========================================
  Files            78         78          
  Lines          8121       8126     +5   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           7200       7205     +5   
  Misses          921        921          
  Partials          0          0          

Sunburst

Powered by Codecov. Last update 5b5e451...a5c2d26

@@ -1169,6 +1169,8 @@ def __getitem__(self, key):
"S", (0, 0, 0)),
(vartype(TimeVariable()),
"T", (68, 170, 255)),
(vartype(Variable),
"?", (128, 128, 128)),
Copy link
Contributor

Choose a reason for hiding this comment

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

But isn't Variable just a base class? Won't this open the door for certain errors to pass silently?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes it would. I removed it.

@@ -899,6 +898,12 @@ def __init__(self, *args, **kwargs):
self.have_date = 0
self.have_time = 0

def copy(self, compute_value=None):
copy = super().copy(compute_value=compute_value)
copy.have_data = self.have_date
Copy link
Member

Choose a reason for hiding this comment

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

*have_date

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. Fixed.

Due to static constructors in Variable.copy and ContinuousVariable.copy
the StringVariable.copy and TimeVariable.copy used to return Variable
and ContinuousVariable instances respectively.

Fix this by dispatching on `type(self)`.
@lanzagar lanzagar merged commit d84aadf into biolab:master Sep 23, 2016
@ales-erjavec ales-erjavec deleted the variable-copy branch September 28, 2016 10:29
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.

5 participants