Re: [Bioc-devel] writing unit tests for functions in an initializer

2017-09-28 Thread Hervé Pagès
Yep. And w.r.t. empty objects, make sure new("MyClass") works and returns a valid object. This should produce an "empty" object. Note that the explicit constructor function should be named as the class itself (e.g. MyClass()). It's up to you to decide whether it should support being called with n

Re: [Bioc-devel] writing unit tests for functions in an initializer

2017-09-28 Thread Michael Lawrence
I agree with Kasper. You are better off just leaving initialize() to its default implementation. Violating that abstraction for the purpose of testing is only going to put your software more at risk, defeating the purpose of testing. Overriding initialize() makes it do more than just set slots, bu

Re: [Bioc-devel] writing unit tests for functions in an initializer

2017-09-28 Thread Kasper Daniel Hansen
Ok, this is answering a different question, but the recommendation is to avoid spending time on the initialize method and instead write am explicit constructor function. On Thu, Sep 28, 2017 at 10:48 AM, Zach Skidmore wrote: > Hi All, > > I maintain the GenVisR package and am currently convertin

[Bioc-devel] writing unit tests for functions in an initializer

2017-09-28 Thread Zach Skidmore
Hi All, I maintain the GenVisR package and am currently converting it to S4 classes. I'm running into a problem however when writing unit tests for functions within the initalizer. What I really need is a "mock" object of the class for which the initializer unit tests are being performed but wh