Skip to content

Add unit tests for modules with zero coverage#1

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1780560429-add-unit-tests
Open

Add unit tests for modules with zero coverage#1
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1780560429-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repo had zero unit tests — existing *-test.py files were demo scripts with no assertions. This PR adds a tests/ directory with 55 unit tests covering the 8 modules that contain reusable functions/classes:

Test file Module under test Tests What's covered
test_stack.py stacks/example1.py 9 Stack.push, pop, peek, is_empty, size, edge cases
test_queue.py queues/example3.py 10 Queue.enqueue, dequeue, front, is_empty, size, underflow
test_tree.py trees/example1.py 6 TreeNode creation, left/right children, reassignment
test_general_node.py algorithms/DataStructures/trees/example1.py 6 Node creation, children list, nesting
test_algorithms.py algorithms/algorithm{23-27}.py 24 count_items, square, find_largest, check_even_odd, add_numbers

Uses importlib.util to load modules by file path, avoiding name collisions between the many example1.py files. Module-level print() side effects are suppressed via unittest.mock.patch.

Run with: python -m unittest discover tests/ -v

Link to Devin session: https://app.devin.ai/sessions/72e05617fcdc4334b084a2438abc874f
Requested by: @Agaba25

- test_stack.py: 9 tests for Stack class (stacks/example1.py)
- test_queue.py: 10 tests for Queue class (queues/example3.py)
- test_tree.py: 6 tests for TreeNode class (trees/example1.py)
- test_general_node.py: 6 tests for Node class (algorithms/DataStructures/trees/example1.py)
- test_algorithms.py: 24 tests for count_items, square, find_largest, check_even_odd, add_numbers

Total: 55 unit tests covering 8 previously untested modules.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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.

1 participant