Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
iamdbychkov opened this issue Jan 31, 2022 · 6 comments

Comments

@iamdbychkov
Copy link

iamdbychkov commented Jan 31, 2022

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?

@iamdbychkov iamdbychkov changed the title Clarification for chapter 4, service layer exercies. Clarification for chapter 4, service layer exercise. Jan 31, 2022
@hjwp
Copy link
Contributor

hjwp commented Apr 23, 2022

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

@hjwp hjwp closed this as completed Apr 23, 2022
@hjwp
Copy link
Contributor

hjwp commented Apr 23, 2022

(PS cosmicpython/book@667b2fd)

@iamdbychkov
Copy link
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 👍

@hjwp
Copy link
Contributor

hjwp commented May 9, 2022

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 😊

@Xupeiyi
Copy link

Xupeiyi commented Apr 8, 2023

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

@hjwp
Copy link
Contributor

hjwp commented May 9, 2023

oh yes! you're quite right sorry

@hjwp hjwp reopened this May 9, 2023
@hjwp hjwp changed the title Clarification for chapter 4, service layer exercise. chapter 4, service layer exercise, "decrement" should be "increment" in test names May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants