forked from MIT-Emerging-Talent/ET6-practice-code-review
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Delete solutions/tests/test_Remove_Duplicate.py"
This reverts commit 99b9c12.
- Loading branch information
1 parent
9443014
commit 6d6d843
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
""" | ||
Test module for Remove Duplicate function. | ||
Created on 2024-01-10 | ||
Author: Safaa Osman | ||
""" | ||
|
||
import unittest | ||
|
||
from ..Remove_Duplicates import Remove_Duplicates | ||
|
||
|
||
class TestRemoveDuplicates(unittest.TestCase): | ||
"""Test the Remove_Duplicates function - some tests are buggy!""" | ||
|
||
def test_empty_list(self): | ||
"""It should return [] for an empty list""" | ||
self.assertEqual(Remove_Duplicates([]), []) | ||
|
||
def test_no_duplicates(self): | ||
"""It should return the same list for list without duplicates""" | ||
self.assertEqual(Remove_Duplicates([1, 2, 3]), [1, 2, 3]) | ||
|
||
def test_not_list(self): | ||
"""It should raise AssertionError for non-list input""" | ||
with self.assertRaises(AssertionError): | ||
Remove_Duplicates("123") | ||
|
||
def test_All_duplicates(self): | ||
"""It should return the list of one item that duplicates""" | ||
self.assertEqual(Remove_Duplicates([1, 1, 1, 1, 1, 1]), [1]) | ||
|
||
def test_list_with_duplicates(self): | ||
"""It should return the list without duplicates""" | ||
self.assertEqual(Remove_Duplicates([1, 1, 2, 2, 3, 4]), [1, 2, 3, 4]) | ||
|
||
def test_Mix_types_of_elements(self): | ||
"""It should return the list of elements without duplicates""" | ||
self.assertEqual( | ||
Remove_Duplicates([1, "Safaa", 3.5, "Safaa", "safaa", 3.5]), | ||
[1, "Safaa", 3.5, "safaa"], | ||
) |