|
1 | 1 | import unittest
|
2 | 2 | from unittest.mock import patch
|
3 |
| -from .simulation import simulate_coding_framework |
| 3 | +from simulation import simulate_coding_framework |
4 | 4 |
|
5 | 5 | class TestSimulateCodingFramework(unittest.TestCase):
|
6 | 6 |
|
@@ -39,26 +39,18 @@ def setUp(self):
|
39 | 39 |
|
40 | 40 | def test_group_1(self):
|
41 | 41 | output = simulate_coding_framework(self.test_data_1)
|
42 |
| - # Asserting the order of operations and their expected outcomes |
43 |
| - self.assertEqual(output, ["uploaded Cars.txt", "got Cars.txt", "copied Cars.txt to Cars2.txt", "got Cars2.txt"]) # Assuming successful FILE_UPLOAD and FILE_COPY operations return the operation and file name |
| 42 | + self.assertEqual(output, ["uploaded Cars.txt", "got Cars.txt", "copied Cars.txt to Cars2.txt", "got Cars2.txt"]) |
44 | 43 |
|
45 | 44 | def test_group_2(self):
|
46 | 45 | output = simulate_coding_framework(self.test_data_2)
|
47 |
| - # Asserting the order and expecting a list of files that match the FILE_SEARCH prefix "Ba" |
48 |
| - self.assertEqual(output, ["uploaded Foo.txt", "uploaded Bar.csv", "uploaded Baz.pdf", "found [Bar.csv, Baz.pdf]"]) # Assuming FILE_SEARCH returns files in descending order of their size with the operation and file name represented as a list string |
| 46 | + self.assertEqual(output, ["uploaded Foo.txt", "uploaded Bar.csv", "uploaded Baz.pdf", "found [Bar.csv, Baz.pdf]"]) |
49 | 47 |
|
50 | 48 | def test_group_3(self):
|
51 | 49 | output = simulate_coding_framework(self.test_data_3)
|
52 |
| - # Asserting the order and handling of TTL in FILE_UPLOAD_AT and the existence of files at the time of FILE_GET_AT |
53 |
| - # Adjusting the expected output for "got at Expired.txt" to reflect the requirement that expired files should return "file not found" |
54 |
| - self.assertEqual(output, ["uploaded at Python.txt", "uploaded at CodeSignal.txt", "got at Python.txt", "copied at Python.txt to PythonCopy.txt", "found at [Python.txt]", "uploaded at Expired.txt", "file not found", "copied at CodeSignal.txt to CodeSignalCopy.txt", "found at [CodeSignal.txt]"]) # Assuming FILE_UPLOAD_AT and FILE_COPY_AT operations are successful, FILE_SEARCH_AT returns alive files, and FILE_GET_AT returns "file not found" for expired files with the operation and file name represented as a list string |
| 50 | + self.assertEqual(output, ["uploaded at Python.txt", "uploaded at CodeSignal.txt", "got at Python.txt", "copied at Python.txt to PythonCopy.txt", "found at [Python.txt]", "uploaded at Expired.txt", "file not found", "copied at CodeSignal.txt to CodeSignalCopy.txt", "found at [CodeSignal.txt]"]) |
55 | 51 |
|
56 | 52 | def test_group_4(self):
|
57 | 53 | output = simulate_coding_framework(self.test_data_4)
|
58 |
| - # Asserting the order, especially after a ROLLBACK operation, and the expected state of files |
59 |
| - # The expected output has been corrected to accurately reflect the expected results of FILE_SEARCH_AT and FILE_GET_AT operations post-ROLLBACK |
60 |
| - # FILE_SEARCH_AT should only return files that existed at the time of the search and are not affected by the ROLLBACK |
61 |
| - # FILE_GET_AT for "Update2.txt" should return "file not found" since it would not exist after the ROLLBACK to a time before its upload |
62 |
| - self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt, Initial.txt]", "file not found"]) # This correction ensures that the expected output aligns with the logical outcomes of the operations given the ROLLBACK, particularly highlighting the correct handling of the FILE_SEARCH_AT operation to only include files that are "alive" and the FILE_GET_AT operation to accurately reflect the non-existence of "Update2.txt" post-ROLLBACK. |
| 54 | + self.assertEqual(output, ["uploaded at Initial.txt", "uploaded at Update1.txt", "got at Initial.txt", "copied at Update1.txt to Update1Copy.txt", "uploaded at Update2.txt", "rollback to 2021-07-01T12:10:00", "got at Update1.txt", "got at Initial.txt", "found at [Update1.txt, Initial.txt]", "file not found"]) |
63 | 55 | if __name__ == '__main__':
|
64 | 56 | unittest.main()
|
0 commit comments