Skip to content

system check assessment#7

Open
let-Hazel wants to merge 1 commit into
micanipho:mainfrom
let-Hazel:main
Open

system check assessment#7
let-Hazel wants to merge 1 commit into
micanipho:mainfrom
let-Hazel:main

Conversation

@let-Hazel
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements solutions for a Python assessment covering data parsing, algorithmic logic, and test-driven development. The submission includes implementations for five functions (flight ticket parsing functions, leap year logic, and reactor status monitoring) along with a required test file for the reactor status function.

Key Changes:

  • Implemented flight ticket parsing functions (get_departure_airport, check_baggage_allowance, validate_flight_number)
  • Implemented leap year calculation logic with modulo operations
  • Implemented reactor status monitoring with multi-condition logic
  • Created test_reactor.py with unit tests for the reactor status function

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 10 comments.

File Description
test_reactor.py New test file containing TestReactor class with unit tests for reactor_status function, following unittest framework conventions
system_check.py Implementations added for all five assessment functions, but includes debug code that should be removed and a critical bug in validate_flight_number
pycache/system_check.cpython-312.pyc Compiled Python bytecode file that should not be committed to version control

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread system_check.py
Comment on lines +55 to +56
ticket_string = "FL-JO234-JNB-CPT-2023"
check_baggage_allowance(ticket_string)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this test/debug code. Function definitions in a module should not include standalone function calls at the module level, as they execute on import and can cause unexpected side effects.

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
Comment on lines +85 to +88
ticket_string = "FL-JOABC-JNB-CPT"


validate_flight_number(ticket_string)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this test/debug code. Function definitions in a module should not include standalone function calls at the module level, as they execute on import and can cause unexpected side effects.

Copilot uses AI. Check for mistakes.
Comment thread system_check.py

ticket = ticket_string[1]

ticket_num = ticket[-1]
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

This only checks the last character of the flight number, not the entire numeric portion. According to the docstring (line 62), you need to extract "the number portion (e.g., 234)" from "JO234". You should extract all trailing digits from the flight number string, not just the last character. For example, for "JO234", you need to extract "234" and check if it's even/odd, not just "4".

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
else:
return False
else:
return True
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove trailing whitespace at the end of this line.

Suggested change
return True
return True

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
else:
return "Normal Operation"


Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this unnecessary blank line at the end of the file.

Suggested change

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
Comment on lines +24 to +25
ticket_string = "FL-JO234-JNB-CPT-2023"
get_departure_airport(ticket_string)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this test/debug code. Function definitions in a module should not include standalone function calls at the module level, as they execute on import and can cause unexpected side effects.

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
Comment on lines +121 to +123
year = 2000

is_leap_year(year)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this test/debug code. Function definitions in a module should not include standalone function calls at the module level, as they execute on import and can cause unexpected side effects.

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
return "Normal Operation"


reactor_status(-1, 50)
Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove this test/debug code. Function definitions in a module should not include standalone function calls at the module level, as they execute on import and can cause unexpected side effects.

Suggested change
reactor_status(-1, 50)

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
Comment on lines +71 to +84

ticket = ticket_string[1]

ticket_num = ticket[-1]

if not ticket_num.isdigit():
return "Invalid Flight"

if int(ticket_num)%2 == 0:
return "Valid - Northbound"
elif int(ticket_num)%2 != 0:
return "Valid - Southbound"


Copy link

Copilot AI Nov 28, 2025

Choose a reason for hiding this comment

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

Remove the unnecessary blank line. This creates inconsistent spacing in the function body.

Suggested change
ticket = ticket_string[1]
ticket_num = ticket[-1]
if not ticket_num.isdigit():
return "Invalid Flight"
if int(ticket_num)%2 == 0:
return "Valid - Northbound"
elif int(ticket_num)%2 != 0:
return "Valid - Southbound"
ticket = ticket_string[1]
ticket_num = ticket[-1]
if not ticket_num.isdigit():
return "Invalid Flight"
if int(ticket_num)%2 == 0:
return "Valid - Northbound"
elif int(ticket_num)%2 != 0:
return "Valid - Southbound"

Copilot uses AI. Check for mistakes.
Comment thread system_check.py
return "Sensor Error"
elif temp > 2000 or radiation > 500:
return "CRITICAL"
elif 1000 <= temp <= 2000 and radiation > 100:
Copy link

Copilot AI Nov 28, 2025

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.

Copilot uses AI. Check for mistakes.
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