-
Notifications
You must be signed in to change notification settings - Fork 15
Keamogetswe's submission #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "python.testing.unittestArgs": [ | ||
| "-v", | ||
| "-s", | ||
| ".", | ||
| "-p", | ||
| "test_*.py" | ||
| ], | ||
| "python.testing.pytestEnabled": false, | ||
| "python.testing.unittestEnabled": true | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,7 +18,12 @@ def get_departure_airport(ticket_string: str): | |||||||||||||
| Flight Number (JO234) can vary in length. You must find it relative to the hyphens. | ||||||||||||||
| """ | ||||||||||||||
| # TODO: Write your code here | ||||||||||||||
| pass | ||||||||||||||
| new_string = ticket_string.split("-") | ||||||||||||||
| depature_airport_code = new_string[2] | ||||||||||||||
| return depature_airport_code | ||||||||||||||
| print(get_departure_airport("FL-JO234-JNB-CPT-2023")) | ||||||||||||||
|
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| def check_baggage_allowance(ticket_string: str): | ||||||||||||||
| """ | ||||||||||||||
|
|
@@ -36,7 +41,17 @@ def check_baggage_allowance(ticket_string: str): | |||||||||||||
| - For any other code: return "Standard - 0kg" | ||||||||||||||
| """ | ||||||||||||||
| # TODO: Write your code here | ||||||||||||||
| pass | ||||||||||||||
| new_string = ticket_string.split("-") | ||||||||||||||
| baggage_allowance = new_string[0] | ||||||||||||||
| if baggage_allowance == 'EC': | ||||||||||||||
| return "Economy - 20kg" | ||||||||||||||
| if baggage_allowance == 'BS': | ||||||||||||||
| return "Business - 40kg" | ||||||||||||||
| if baggage_allowance == 'FL': | ||||||||||||||
|
Comment on lines
+48
to
+50
|
||||||||||||||
| if baggage_allowance == 'BS': | |
| return "Business - 40kg" | |
| if baggage_allowance == 'FL': | |
| elif baggage_allowance == 'BS': | |
| return "Business - 40kg" | |
| elif baggage_allowance == 'FL': |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug print statement should be removed from production code. Print statements at the module level can clutter output and are typically only used during development/debugging.
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using elif instead of separate if statements for the mutually exclusive northbound/southbound conditions. Since a number can't be both even and odd, using elif improves code clarity.
For example:
if number_portion % 2 == 0:
return "Valid - Northbound"
else: # or elif number_portion % 2 != 0:
return "Valid - Southbound"| if number_portion % 2 != 0: | |
| elif number_portion % 2 != 0: |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug print statement should be removed from production code. Print statements at the module level can clutter output and are typically only used during development/debugging.
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic order is incorrect. The function checks for WARNING conditions before checking for CRITICAL or Sensor Error conditions. This means that values like temp=1500, radiation=600 will incorrectly return "WARNING" instead of "CRITICAL" (since radiation > 500 should trigger CRITICAL).
The checks should be reordered according to the documented priority in the docstring:
- Sensor Error (negative checks) - first
- CRITICAL checks - second
- WARNING checks - third
- Maintenance Mode - fourth
- Normal Operation - last
Correct order:
if temp < 0 or radiation < 0:
return "Sensor Error"
if temp > 2000 or radiation > 500:
return "CRITICAL"
if temp in range(1000, 2001) and radiation > 100:
return "WARNING"
if temp < 500:
return "Maintenance Mode"
else:
return "Normal Operation"
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This debug print statement should be removed from production code. Print statements at the module level can clutter output and are typically only used during development/debugging.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,19 @@ | ||||||
| import unittest | ||||||
| from system_check import reactor_status | ||||||
|
|
||||||
| class TestReactor: | ||||||
|
||||||
| class TestReactor: | |
| class TestReactor(unittest.TestCase): |
Copilot
AI
Nov 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test coverage for reactor_status is incomplete. According to the logic tree in the function's docstring, the following scenarios are missing tests:
- Sensor Error: No test case for negative temperature or radiation (e.g.,
reactor_status(-1, 50)orreactor_status(500, -10)) - Maintenance Mode: No test case for temperature < 500 (e.g.,
reactor_status(400, 50))
These scenarios are tested in test_system_check.py but should also be included here for comprehensive TDD coverage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo in variable name: "depature" should be "departure".