pyDoubles 1.3 released

What's new in pyDoubles 1.3?

  1. times statement is also available in spies, not only mocks
  2. stubs ignoring arguments can live together with stubs defined with arguments
  3. a new matcher: obj_with_fields

1: This sintax is now possible:

  2. assert_that_method(spy_obj.some_method).was_called().times(2)
  3. or
  4. assert_that_method(spy_obj.some_method).was_called(
  5. ).with_args(SOME_VALUE).times(2)

2: The most precise matching condition will be used:

  2. when(spy_obj.some_method).then_return(SOME_VALUE)
  3. when(spy_obj.some_method).with_args(10
  4. ).then_return(OTHER_VALUE)

The two lines above inside a test would mean the objet will return OTHER_VALUE when the input parameter will be 10 and SOME_VALUE in any other case. In previous releases, it would return SOME_VALUE always because stubs ignoring arguments use to override any other stub definition.

3: obj_with_fields matcher:

  2. assert_that_method(spy_obj.some_method).was_called(
  3. ).with_args(obj_with_fields({'id': 20, 'name': 'Carlos'}))

Which means the object passed in as a parameter, should have fields id and name with those values.

  •;u=54191 alexander wang shoes

    I have been browsing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my opinion, if all site owners and bloggers made good content as you did, the net will be much more useful than ever before.