Re: [R] Using a mock of an S4 class

2017-02-03 Thread Ramiro Barrantes
Thank you so much!! This is very helpful. On 02/01/2017 02:46 PM, Ramiro Barrantes wrote: > Hello, > > I have a function that applies to an S4 object which contains a slot called > @analysis: > > function calculation(myObject) { > tmp <- myObjects@analysis > result <- ...operations on

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Martin Morgan
On 02/01/2017 02:46 PM, Ramiro Barrantes wrote: Hello, I have a function that applies to an S4 object which contains a slot called @analysis: function calculation(myObject) { tmp <- myObjects@analysis result <- ...operations on analysis... return result } I am writing a unit test for

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Jeff Newmiller
You seem like you have painted yourself into a corner... you want to access slots in an S4 object yet you don't want to create one. Are you going to do this test without the benefit of an operating system either? Beware of getting too meta... David didn't say you had to use an S4 object

Re: [R] Using a mock of an S4 class

2017-02-02 Thread Ramiro Barrantes
Yes, so are you suggesting that I create an instance of my S4 class in order to test my function. My understanding is that ideally the test should not depend on any code besides the one that I am testing. I just thought that you could perhaps define a mock class so that I would not need to

Re: [R] Using a mock of an S4 class

2017-02-01 Thread David Winsemius
> On Feb 1, 2017, at 11:46 AM, Ramiro Barrantes > wrote: > > Hello, > > I have a function that applies to an S4 object which contains a slot called > @analysis: > > function calculation(myObject) { > tmp <- myObjects@analysis > result <- ...operations on