-
Notifications
You must be signed in to change notification settings - Fork 15
Mthunzy #1
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?
Mthunzy #1
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 | ||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -18,6 +18,8 @@ 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 | ||||||||||||||||||||||||||||||||||||||
| splitted_ticket = ticket_string.split("-") | ||||||||||||||||||||||||||||||||||||||
| return splitted_ticket[2] | ||||||||||||||||||||||||||||||||||||||
| pass | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||
| def check_baggage_allowance(ticket_string: str): | ||||||||||||||||||||||||||||||||||||||
|
|
@@ -36,6 +38,15 @@ def check_baggage_allowance(ticket_string: str): | |||||||||||||||||||||||||||||||||||||
| - For any other code: return "Standard - 0kg" | ||||||||||||||||||||||||||||||||||||||
| """ | ||||||||||||||||||||||||||||||||||||||
| # TODO: Write your code here | ||||||||||||||||||||||||||||||||||||||
| splitted_ticket = ticket_string.split("-") | ||||||||||||||||||||||||||||||||||||||
| cl = splitted_ticket[0] | ||||||||||||||||||||||||||||||||||||||
| if cl == "EC": | ||||||||||||||||||||||||||||||||||||||
| return "Economy - 20kg" | ||||||||||||||||||||||||||||||||||||||
| elif cl == "BS": | ||||||||||||||||||||||||||||||||||||||
| return "Business - 40kg" | ||||||||||||||||||||||||||||||||||||||
| elif cl == "FL": | ||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+42
to
+47
|
||||||||||||||||||||||||||||||||||||||
| cl = splitted_ticket[0] | |
| if cl == "EC": | |
| return "Economy - 20kg" | |
| elif cl == "BS": | |
| return "Business - 40kg" | |
| elif cl == "FL": | |
| flight_class = splitted_ticket[0] | |
| if flight_class == "EC": | |
| return "Economy - 20kg" | |
| elif flight_class == "BS": | |
| return "Business - 40kg" | |
| elif flight_class == "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.
Unreachable code: the pass statement on line 50 will never execute because the function returns on line 49. Remove this line to clean up the code.
| pass |
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.
Missing spaces around the modulo and equality operators. According to PEP 8 style guidelines, change int(t_number)%2 == 0 to int(t_number) % 2 == 0 for better readability.
| if int(t_number)%2 == 0: | |
| if int(t_number) % 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.
The logic only checks the last digit of the flight number (ticket_number[-1]) instead of extracting and checking the entire numeric portion. For example, in "JO234", this code checks if "4" is even/odd, but it should check if "234" is even/odd. Extract the numeric part properly (e.g., using ticket_number[2:] for "JO234") and convert it to an integer before checking.
| t_number = ticket_number[-1] | |
| if t_number.isdigit(): | |
| if int(t_number)%2 == 0: | |
| return "Valid - Northbound" | |
| else: | |
| return "Valid - Southbound" | |
| # Extract numeric portion from flight number (e.g., "JO234" -> "234") | |
| numeric_part = ''.join(filter(str.isdigit, ticket_number)) | |
| if numeric_part: | |
| try: | |
| num = int(numeric_part) | |
| if num % 2 == 0: | |
| return "Valid - Northbound" | |
| else: | |
| return "Valid - Southbound" | |
| except ValueError: | |
| return "Invalid Flight" |
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.
Unreachable code: the pass statement on line 75 will never execute because the function returns on line 74. Remove this line to clean up the code.
| pass |
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.
Missing spaces around the modulo operator. According to PEP 8 style guidelines, binary operators should have spaces around them. Change year%4 to year % 4, year%100 to year % 100, and year%400 to year % 400 for better readability.
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.
Unreachable code: the pass statement on line 104 will never execute because the function returns on lines 96-102. Remove this line to clean up the code.
| pass |
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.
Test is always true, because of this condition.
| if (temp >= 1000 and temp <= 2000) and radiation > 100: | |
| if temp >= 1000 and radiation > 100: |
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.
Unreachable code: the pass statement on line 146 will never execute because the function returns on line 145. Remove this line to clean up the code.
| pass |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,3 @@ | ||||||
| class TestReactor: | ||||||
| def __int__(self): | ||||||
|
||||||
| def __int__(self): | |
| def __init__(self): |
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 TestReactor class is empty and doesn't contain any test methods. According to the requirements in system_check.py (lines 117-118), this class should implement TDD tests for the reactor_status function. The class should inherit from unittest.TestCase and include test methods for the various reactor status conditions (Sensor Error, CRITICAL, WARNING, Maintenance Mode, and Normal Operation).
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 ticket string is split multiple times across different functions (lines 21, 41, 64). Consider adding input validation and error handling for the split operation. If the ticket string doesn't contain the expected number of hyphens, the code will raise an IndexError. This would improve robustness.