Monash University · FACULTY OF INFORMATION TECHNOLOGY

FIT9136 Chap.6 Modules, Libraries and Unit Testing

- one subject, every graph, every model, every mark
5 Chapters2-page Bible
Our own words - no uploaded lecturer files
Updated for this semester
Chapter 6 of 8 · FIT9136

Modules, Libraries and Unit Testing

Define module

The course material gives this chapter a concrete anchor: Weeks 7 and 10 combine library discovery with assertions and unit-level verification. That module anchor controls how library is explained and how unit test is tested in changed practice.

Modules, Libraries and Unit Testing turns module, library and unit test into executable reasoning.

The chapter's practical target is to reuse a library through a clear interface and verify the surrounding code, so every explanation should connect syntax to program state, control flow and observable output.

Treat module as a precise program object, not a loose label. Identify the value or responsibility of module before execution, then trace what can read it, change it or depend on it.

This makes state changes visible before they become debugging guesses.

Use library to explain the program's next move. Work through one representative library input by hand and name the branch, iteration or call that follows. If the library trace cannot be stated, the code may run by accident rather than by understood design.

Bring in unit test as the test of structure.

Compare normal, boundary and invalid inputs for unit test; state the expected behaviour first; then use the mismatch between expectation and result to localise the defect.

For the application — reuse a library through a clear interface and verify the surrounding code — write the smallest complete example that exposes the rule.

Explain why the unit test result works, what would break it and how the program should signal or recover from that failure.

Trace library

Before running an example involving module, make a trace table with the important state before and after each operation. Include the value associated with module, the control decision governed by library and the output or object affected by unit test.

The module table turns an unexplained result into a sequence that can be tested one transition at a time.

Test three inputs: an ordinary case, a boundary case and an invalid case. State the expected unit test result for each before execution, then compare it with what the program actually does.

A useful test of library isolates one rule; changing several conditions at once cannot reveal which condition caused the failure.

Practise explaining the solution without reading the code. For fit9136, name the data representation, the control flow, the responsibility of each function or class and the reason the chosen design supports reuse a library through a clear interface and verify the surrounding code.

This unit test rehearsal matters when a written test or interview asks why the program works rather than whether it produces one correct output.

A complete response should make the task visible before the detail: identify what must be decided, define the relevant terms, connect the evidence to library, and use unit test to test the result.

The final sentence about unit test should answer the question actually asked rather than merely repeat the topic.

The controlling limit is specific: Library availability does not prove correct arguments, units or interpretation.

Keep that unit test limit beside the worked example, because it separates a careful fit9136 answer from one that sounds confident but claims more than the task or evidence supports.

For revision, retrieve module, library and unit test without notes, explain their relationship aloud, then complete a changed version of the application: reuse a library through a clear interface and verify the surrounding code.

Record the first failed library reasoning move and repair it before attempting another case.

In this chapter

What this chapter covers

  • 01

    module

  • 02

    library

  • 03

    unit test

  • 04

    Applying module

  • 05

    Limits of library and unit test

Worked example · free

Test a discount function

Q [4 marks]. AskSia-authored practice. A function returns price after a percentage discount. Choose a compact but useful test set.
  • 1Test zero discount and a normal positive case.
  • 1Test a 100% discount boundary.
  • 1Test invalid negative price or out-of-range percentage according to the contract.
  • 1Compare numeric results with an explicit tolerance if needed.
The suite checks ordinary arithmetic, both meaningful boundaries and invalid inputs, making the function contract executable.
Sia tip — A test list should mirror the risk surface, not the examples shown in the function docstring.
Glossary

Key terms

module
Python file or package namespace containing reusable definitions. This chapter uses the concept when students reuse a library through a clear interface and verify the surrounding code. Use this definition when the task is to reuse a library through a clear interface and verify the surrounding code.
library
Organised collection of modules providing tested capabilities. It helps explain the reasoning required to reuse a library through a clear interface and verify the surrounding code. Use this definition when the task is to reuse a library through a clear interface and verify the surrounding code.
unit test
Automated check of one small behaviour under declared input and expected output. Its limit matters because library availability does not prove correct arguments, units or interpretation. Use this definition when the task is to reuse a library through a clear interface and verify the surrounding code.
FAQ

Modules, Libraries and Unit Testing FAQ

What is the main task in Modules, Libraries and Unit Testing?

Reuse a library through a clear interface and verify the surrounding code.

How do module and library work together?

Use module to establish the object or condition, then use library to explain how it changes the outcome being analysed.

What must a fit9136 answer qualify here?

Library availability does not prove correct arguments, units or interpretation.

How should I revise Modules, Libraries and Unit Testing?

Retrieve module, library and unit test, apply them to a changed case, and correct the first point where the evidence no longer supports the conclusion.

Study strategy

Assessment move

Reconstruct the relationship among module, library and unit test; complete the chapter application without notes; then test the result against this limit: Library availability does not prove correct arguments, units or interpretation.

Working through Modules, Libraries and Unit Testing in FIT9136? Sia is AskSia’s AI Information Technology tutor — ask any FIT9136 Modules, Libraries and Unit Testing question and get a clear, step-by-step explanation grounded in how FIT9136 is taught and assessed. Read this chapter free, then take your hardest questions to Sia.

A+Everything unlocked
Unlocks this Bible + all 69 of your Monash University subjects - and 1,000+ Bibles across every Australian university.
Sia - your FIT9136 tutor, unlimited, worked the way the exam marks it
The full 2-page Bible + practice bank with worked solutions
Chrome extension - sync your LMS so Sia knows your deadlines
Bilingual EN / Chinese on every Bible and every Sia answer
$0.99 Trial
30-day money-back · cancel in one tap · how it works
FIT9136 · Introduction to Python Programming - independent study guide on the AskSia Library. More Monash University subjects · Microeconomics across all universities
Unlock the full FIT9136 Bible + 69 Monash University subjects
$0.99 Trial