200-901 Software Development and Design Practice Question
A developer is writing a Python unit test for a function that parses interface status from a network device. The function raises a custom exception called InterfaceDownError when an interface is administratively down. Which unittest assertion correctly verifies that calling parse_interface('down') raises InterfaceDownError?
⚠ Common exam trap
The trap here is calling the function directly inside an assertion that is not designed to catch exceptions, which causes a test error instead of a clean pass or fail.
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
self.assertRaises(InterfaceDownError, parse_interface, 'down')
The unittest framework provides assertRaises specifically for verifying that a callable raises a particular exception when invoked with given arguments. It calls parse_interface('down') and succeeds only if InterfaceDownError is raised. The other assertions either compare values, invoke the function outside an exception context, or check types incorrectly, so they do not validate the exception behavior.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
self.assertTrue(parse_interface('down') == InterfaceDownError)
Why it's wrong here
This calls parse_interface('down') directly, which raises InterfaceDownError before the comparison can happen, causing the test to error rather than pass. Even if no exception were raised, comparing a return value to an exception class is logically incorrect. It does not properly test for the expected exception.
- ✗
self.assertEqual(parse_interface, 'down')
Why it's wrong here
assertEqual compares two values for equality; it does not invoke the function or check for exceptions. Passing the function object and a string would simply compare them and fail, and it would not trigger the code path that raises InterfaceDownError. This assertion is unrelated to exception testing.
- ✓
self.assertRaises(InterfaceDownError, parse_interface, 'down')
Why this is correct
assertRaises accepts an exception class, a callable, and any arguments to pass to that callable. It invokes parse_interface('down') and passes the test only if InterfaceDownError is raised. This is the correct unittest idiom for verifying that a specific exception occurs under the given scenario.
- ✗
self.assertIsInstance(parse_interface, InterfaceDownError)
Why it's wrong here
assertIsInstance checks whether an object is an instance of a class. Here it receives the function object itself, not a result of calling it, and never triggers the exception. This assertion does not exercise the parse_interface('down') call and therefore cannot verify the expected exception behavior.
Go deeper
Related to this question
About these practice questions
This 200-901 question is part of Courseiva's 975-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →
JA
Written and reviewed by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
Last reviewed September 2026 · checked against the official Cisco exam blueprint
This 200-901 practice question is part of Courseiva's free Cisco certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the 200-901 exam.