Skip to content

chapter 4, service layer exercise, "decrement" should be "increment" in test names #48

Description

@iamdbychkov

In chapter 4, we are challenged to implement a deallocation service, given a link with some stubs for tests and some complete e2e tests.
There are some inaccuracies with the exercies which I have found:

  1. services.add_batch("b1", "BLUE-PLINTH", 100, None, repo, session)

    Test uses unexistent service add_batch. Shall we also implement it with tests? I would say yes. Maybe it worth to be included in the book itself?

  2. services.allocate("o1", "BLUE-PLINTH", 10, repo, session)

    Invalid call for a service.allocate() function.

Unclear cases:

def test_deallocate_decrements_available_quantity():

def test_deallocate_decrements_correct_quantity():

What is an expected outcome of such functions? My intertpretation is that in first test we can deallocate any line with matching orderid and sku which is allocated. In the second test we deallocate the line with matching orderid, sku and qty. Is it correct?

Activity

  1. changed the title [-]Clarification for chapter 4, service layer exercies. [/-] [+]Clarification for chapter 4, service layer exercise. [/+] on Jan 31, 2022
  2. hjwp commented on Apr 23, 2022

    @hjwp
    Contributor

    Hello Dmitry! thanks very much for these questions, it's nice to know someone is having a go at the exercises.

    I've pushed some clarifications/explanations as TODOs in the exercise code, let me know what you think?

    https://github.com/cosmicpython/code/blob/chapter_04_service_layer_exercise/test_services.py#L58

  3. hjwp commented on Apr 23, 2022

    @hjwp
    Contributor
  4. iamdbychkov commented on Apr 25, 2022

    @iamdbychkov
    Author

    I've found exercises quite challenging so I think it fits quite nicely :)
    Also, great job on the book, have enjoyed it. Right now trying to employ DDD techniques in my day job project 👍

  5. hjwp commented on May 9, 2022

    @hjwp
    Contributor

    good luck! hey and if you have a couple of secs to write a review on amazon or goodreads or wherever you like to do that, it'd be much appreciated 😊

  6. Xupeiyi commented on Apr 8, 2023

    @Xupeiyi

    I'm having a question with the tests' names. As allocate decrements the available qunatity, should deallocate actually "increment" the available quantity?

  7. hjwp commented on May 9, 2023

    @hjwp
    Contributor

    oh yes! you're quite right sorry

  8. reopened this on May 9, 2023
  9. changed the title [-]Clarification for chapter 4, service layer exercise. [/-] [+]chapter 4, service layer exercise, "decrement" should be "increment" in test names[/+] on May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions