gnecula / bond

Spy-based testing library.
http://necula01.github.io/bond/
Other
7 stars 3 forks source link

API differences python vs ruby #15

Closed gnecula closed 8 years ago

gnecula commented 9 years ago

I noticed the following:

bond.testing vs bond.TESTING :agent_result_none vs bond.AGENT_RESULT_NONE :agent_result_continue vs ...

It is not most important to keep the APIs identical, but we have to think how will be take advantage of join documentation or tutorials.

xkrogen commented 9 years ago

Yeah, I was thinking about this too. I think some things are inevitably going to be different, e.g. for a special return value in Ruby you really should be using a symbol but Python doesn't have this concept. I was thinking it should be pretty simple to extend your code example switching code to replace small inline snippets as well such that you could just pick your language and the entire tutorial would change where appropriate?

On Wednesday, October 21, 2015, George Necula notifications@github.com wrote:

I noticed the following:

bond.testing vs bond.TESTING :agent_result_none vs bond.AGENT_RESULT_NONE :agent_result_continue vs ...

It is not most important to keep the APIs identical, but we have to think how will be take advantage of join documentation or tutorials.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15.

gnecula commented 9 years ago

A related issue, should we change bond.TESTING into bond.is_active() ? The idea with TESTING being so visible was to have a very clear marker for testing code. But TESTING is not a constant, so we should not use capital letters.

xkrogen commented 9 years ago

Yeah, that's why I didn't call it Bond.TESTING in Ruby, I just couldn't bring myself to treat an all-caps variable as mutable. This is another situation where Ruby convention goes against what Python would have - in Ruby that would be 'Bond#active?', though in this case it might be worth it to deviate from convention slightly to keep the APIs in sync (maybe we could provide both?). In any case I'm in favor of turning it into a method.

On Wednesday, October 21, 2015, George Necula notifications@github.com wrote:

A related issue, should we change bond.TESTING into bond.is_active() ? The idea with TESTING being so visible was to have a very clear marker for testing code. But TESTING is not a constant, so we should not use capital letters.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15#issuecomment-149955908.

gnecula commented 9 years ago

For this inline replacement to work I need to figure out a way to make sphinx add elements with specific classes. It can do this for

if I use ..container:: but not sure it can be done for inline.

George.

On Wed, Oct 21, 2015 at 9:36 AM, Erik notifications@github.com wrote:

Yeah, I was thinking about this too. I think some things are inevitably going to be different, e.g. for a special return value in Ruby you really should be using a symbol but Python doesn't have this concept. I was thinking it should be pretty simple to extend your code example switching code to replace small inline snippets as well such that you could just pick your language and the entire tutorial would change where appropriate?

On Wednesday, October 21, 2015, George Necula notifications@github.com wrote:

I noticed the following:

bond.testing vs bond.TESTING :agent_result_none vs bond.AGENT_RESULT_NONE :agent_result_continue vs ...

It is not most important to keep the APIs identical, but we have to think how will be take advantage of join documentation or tutorials.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15#issuecomment-149954508.

gnecula commented 9 years ago

Ok, we'll call it bond.active in Python and Bond#active? in Ruby. I still hesitate though over the lost of the visual separation, but each project can create their own synonym, if it is a method.

George.

On Wed, Oct 21, 2015 at 9:46 AM, Erik notifications@github.com wrote:

Yeah, that's why I didn't call it Bond.TESTING in Ruby, I just couldn't bring myself to treat an all-caps variable as mutable. This is another situation where Ruby convention goes against what Python would have - in Ruby that would be 'Bond#active?', though in this case it might be worth it to deviate from convention slightly to keep the APIs in sync (maybe we could provide both?). In any case I'm in favor of turning it into a method.

On Wednesday, October 21, 2015, George Necula notifications@github.com wrote:

A related issue, should we change bond.TESTING into bond.is_active() ? The idea with TESTING being so visible was to have a very clear marker for testing code. But TESTING is not a constant, so we should not use capital letters.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15#issuecomment-149955908.

— Reply to this email directly or view it on GitHub https://github.com/necula01/bond/issues/15#issuecomment-149957813.

gnecula commented 9 years ago

I am going to transition pybond to bond.active but leave TESTING as a deprecated synonym

xkrogen commented 9 years ago

Changed to Bond#active? in Ruby. Leaving open until we deal with the API discrepancies in the tutorial / documentation.

xkrogen commented 8 years ago

Going to say that this is resolved through our tab system.