Skip to content

[FIX] Variable: Fix Variable.copy for StringVariable and TimeVariable#1589

Merged
lanzagar merged 1 commit intobiolab:masterfrom
ales-erjavec:variable-copy
Sep 23, 2016
Merged

[FIX] Variable: Fix Variable.copy for StringVariable and TimeVariable#1589
lanzagar merged 1 commit intobiolab:masterfrom
ales-erjavec:variable-copy

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

(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.


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