LCORE-1051: optional types in tests#976
Conversation
WalkthroughType hints are updated across four test files, converting union syntax ( Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~4 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (4)
tests/unit/cache/test_noop_cache.py (1)
3-3: Consider using modern union syntaxstr | Noneinstead ofOptional[str].The PR changes test type hints from modern union syntax (
str | None) to the olderOptional[str]style. Based on retrieved learnings, source files insrc/**/*.pyuse modern union syntax. Modern Python (3.10+) prefersType | NoneoverOptional[Type]for better readability and consistency with PEP 604.Consider keeping the union syntax (
str | None) in test files to maintain consistency with modern Python practices and the coding style used in source files, unless there's a specific project requirement to useOptionalin tests.Based on learnings,
src/**/*.pyfiles use modern union syntax. Should test files follow the same convention?Also applies to: 203-203, 210-210, 217-217
tests/unit/utils/test_responses.py (1)
4-4: Consider using modern union syntaxstr | Noneinstead ofOptional[str].Similar to other test files in this PR, these helper functions convert from modern union syntax to
Optional. Modern Python (3.10+) prefersType | Nonefor better readability and alignment with PEP 604.Consider maintaining the union syntax for consistency with modern Python practices and to avoid unnecessary import overhead.
Based on learnings, source files use modern union syntax. Verify if test files should follow the same convention.
Also applies to: 12-12, 28-28
tests/unit/models/rlsapi/test_requests.py (1)
4-4: Consider using modern union syntaxstr | Noneinstead ofOptional[str].This test function converts from modern union syntax to
Optional[str]. Modern Python (3.10+) recommends usingType | NoneoverOptional[Type]for improved readability and consistency with PEP 604.To align with modern Python practices and maintain consistency across the codebase, consider retaining the union syntax.
Based on learnings, source files prefer modern union syntax. Should test files follow the same convention?
Also applies to: 272-274
tests/e2e/features/steps/feedback.py (1)
3-3: Consider using modern union syntaxstr | Noneinstead ofOptional[str].This behave step helper function converts from modern union syntax to
Optional[str]. Modern Python (3.10+) favorsType | NoneoverOptional[Type]for better consistency with PEP 604 and reduced import dependencies.Consider keeping the union syntax to align with modern Python best practices and maintain consistency with source file conventions.
Based on learnings, source files use modern union syntax. Verify if the same convention should apply to e2e test files.
Also applies to: 76-76
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
tests/e2e/features/steps/feedback.pytests/unit/cache/test_noop_cache.pytests/unit/models/rlsapi/test_requests.pytests/unit/utils/test_responses.py
🧰 Additional context used
📓 Path-based instructions (3)
tests/unit/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
Use pytest for all unit and integration tests
Files:
tests/unit/utils/test_responses.pytests/unit/cache/test_noop_cache.pytests/unit/models/rlsapi/test_requests.py
tests/**/*.py
📄 CodeRabbit inference engine (CLAUDE.md)
tests/**/*.py: Do not use unittest - pytest is the standard for this project
Usepytest-mockfor AsyncMock objects in tests
Files:
tests/unit/utils/test_responses.pytests/unit/cache/test_noop_cache.pytests/unit/models/rlsapi/test_requests.pytests/e2e/features/steps/feedback.py
tests/e2e/**
📄 CodeRabbit inference engine (CLAUDE.md)
Use behave (BDD) framework for end-to-end testing with Gherkin feature files
Files:
tests/e2e/features/steps/feedback.py
🧠 Learnings (3)
📓 Common learnings
Learnt from: CR
Repo: lightspeed-core/lightspeed-stack PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-09T15:39:01.298Z
Learning: Applies to src/**/*.py : Use modern union syntax: `str | int` instead of `Union[str, int]`
Learnt from: CR
Repo: lightspeed-core/lightspeed-stack PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-09T15:39:01.298Z
Learning: Applies to src/**/*.py : Use `Optional[Type]` or `Type | None` for optional types
📚 Learning: 2026-01-09T15:39:01.298Z
Learnt from: CR
Repo: lightspeed-core/lightspeed-stack PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-09T15:39:01.298Z
Learning: Applies to src/**/*.py : Use `Optional[Type]` or `Type | None` for optional types
Applied to files:
tests/unit/utils/test_responses.pytests/unit/models/rlsapi/test_requests.pytests/e2e/features/steps/feedback.py
📚 Learning: 2025-09-02T11:14:17.117Z
Learnt from: radofuchs
Repo: lightspeed-core/lightspeed-stack PR: 485
File: tests/e2e/features/steps/common_http.py:244-255
Timestamp: 2025-09-02T11:14:17.117Z
Learning: The POST step in tests/e2e/features/steps/common_http.py (`access_rest_api_endpoint_post`) is intentionally designed as a general-purpose HTTP POST method, not specifically for REST API endpoints, so it should not include context.api_prefix in the URL construction.
Applied to files:
tests/e2e/features/steps/feedback.py
🧬 Code graph analysis (2)
tests/unit/utils/test_responses.py (1)
src/utils/responses.py (1)
extract_text_from_response_output_item(6-56)
tests/unit/cache/test_noop_cache.py (1)
src/cache/noop_cache.py (1)
NoopCache(12-128)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: build-pr
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
- GitHub Check: E2E: server mode / ci
- GitHub Check: E2E: library mode / ci
Description
LCORE-1051: optional types in tests
Type of change
Tools used to create PR
Related Tickets & Documents
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.