Skip to content

Fix shopping example state handling and add regressions - #73

Merged
gitgik merged 2 commits into
masterfrom
users/gitgik/fix-shopping-example
Nov 22, 2026
Merged

gitgik merged 2 commits into
masterfrom
users/gitgik/fix-shopping-example

Conversation

@gitgik

@gitgik gitgik commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

Problem

The shopping example discards constructor arguments, cannot retrieve a customer's cart, leaves member state uninitialized, and shares default shipment logs. Cart quantity updates and order logs silently do nothing.

Changes

  • Preserve account, product, and shipment fields; initialize inherited member state.
  • Implement cart quantity updates and order-log appends. Reject updates for items outside the cart.
  • Give each shipment independent default logs while preserving explicitly supplied lists.
  • Apply the same fixes to Markdown and both notebooks. Label unfinished workflows.
  • Add nine regression tests that exercise all three versions without new dependencies.

Validation

  • Confirmed all 27 representation-specific regression cases fail before the fixes and pass afterward.
  • Targeted pytest/nbval run: 27 tests and 27 subtests passed, including 18 notebook cells executed in fresh kernels.
  • Both notebook schemas, code parity, and git diff --check pass. Saved outputs and metadata are unchanged.
  • Local tests used Python 3.14. GitHub CI passed on Python 3.9-3.11; link checks and Codacy also passed.

This remains a class-design sketch, not an implementation of checkout, payments, stock reservation, or shipping.

Preserve constructor arguments and inherited customer state, implement cart updates and order logs, and isolate default shipment logs across all three versions. Add regression tests without new dependencies.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7411b498-db61-4f72-8629-4af2b007c3a4
@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the shopping-system state-handling changes.

No open issues 🎉

What changed in this PR

Fixes state handling in the shopping-system class-design example, keeping the Markdown and both notebooks aligned while leaving unfinished workflows explicitly out of scope.

Changes:

  • Preserve constructor arguments, initialize inherited member state, and return the correct customer cart.
  • Implement cart quantity updates and order-log appends, reject updates to absent items, and isolate default shipment logs.
  • Add nine regression tests covering all three representations and document incomplete workflows.
File Description
tests/​test_shopping_example.py Adds regression coverage for state handling across all three representations.
OOP-design/​executed_amazon_system.ipynb Applies state fixes and clarifies unfinished workflows without changing saved outputs.
OOP-design/​designing_amazon_online_shopping_system.md Fixes the documented class implementations and labels the example’s limits.
OOP-design/​designing_amazon_online_shopping_system.ipynb Mirrors the state fixes and scope clarification in the source notebook.

Review effort: Balanced

The regression loader must execute the published snippets, not a separate implementation. Document that it only loads checked-in examples and suppress the specific Bandit B102 and Pylint exec-used warnings on that statement.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 7411b498-db61-4f72-8629-4af2b007c3a4
@gitgik
gitgik merged commit 02d5f26 into master Nov 22, 2026
8 checks passed
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

Successfully merging this pull request may close these issues.

2 participants