This project is a Python-based Library Management System (LMS) designed to help users manage books and borrowing processes. It provides functionalities for user registration, book management, borrowing and returning books, tracking overdue books, and calculating fines. Additionally, the project focuses on testing these functionalities using Unit Testing with unittest
.
The primary goals of this project are to:
- Develop a structured library management system with multiple functionalities.
- Apply concepts of Unit Testing with
unittest
to validate the system. - Practice writing robust, maintainable, and reusable Python code.
- Enhance debugging skills by identifying and addressing edge cases in testing.
- Registration: Users can register with a unique username and password.
- Login: Users can log in to their accounts.
- Add books with attributes like title, author, genre, and count of available copies.
- Remove books by title.
- Search for books by title or author.
- Users can borrow books if available.
- Borrowed books reduce the available count in the library.
- Users can return books, increasing the available count.
- Tracks overdue books and calculates fines based on the number of overdue days.
- Fine rate: $1 per day past the return date.
- Perform CRUD operations on books.
- View overdue records and manage books effectively.
library_management/
├── app/
│ ├── __init__.py
│ ├── main.py # Entry point of the application
│ ├── user.py # User-related classes and functions
│ ├── book.py # Book-related classes and functions
│ ├── borrowing.py # Borrow/return logic
│ └── overdue.py # Overdue fine calculation
├── tests/
│ ├── __init__.py
│ ├── test_user.py # Unit tests for user-related features
│ ├── test_book.py # Unit tests for book-related features
│ ├── test_borrowing.py # Unit tests for borrow/return logic
│ └── test_overdue.py # Unit tests for overdue calculations
└── README.md
The project uses Unit Testing with unittest
to validate each functionality:
-
User Management:
- Test cases for successful registration and login.
- Handle duplicate usernames and invalid login credentials.
-
Book Management:
- Add and remove books.
- Search for books by title and author.
- Handle edge cases like non-existent books.
-
Borrowing/Returning Books:
- Borrow books and update available copies.
- Prevent borrowing unavailable books.
- Test successful book returns.
-
Overdue Tracking:
- Simulate overdue books and calculate fines accurately.
- Validate fine calculation for edge cases.
git clone https://github.com/SCCSMARTCODE/Advanced-Python-Programming
cd library_management_system
Ensure you have Python 3.x installed.
Run the main application:
python app/main.py
Execute unit tests to validate the system:
python -m unittest discover tests
- Implement a graphical user interface (GUI).
- Integrate with a database for persistent storage.
- Add support for email notifications for overdue books.
Contributions are welcome! If you find any bugs or have suggestions for improvements, feel free to submit a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.