Skip to content

Commit d54b6ef

Browse files
committed
Update .gitignore, add VS Code settings, correct file for VS code test ui use.
1 parent dd9cc92 commit d54b6ef

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/.pytest_cache
1+
/.pytest_cache
2+
3+
practice_assessments/**/__pycache__/*

.vscode/settings.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"python.testing.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./practice_assessments",
6+
"-p",
7+
"test*.py"
8+
],
9+
"python.testing.pytestEnabled": false,
10+
"python.testing.unittestEnabled": true,
11+
"python.testing.pytestArgs": ["practice_assessments"]
12+
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

practice_assessments/file_storage/test_simulation.py

+5-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import unittest
22
from unittest.mock import patch
3-
from .simulation import simulate_coding_framework
3+
from simulation import simulate_coding_framework
44

55
class TestSimulateCodingFramework(unittest.TestCase):
66

@@ -39,26 +39,18 @@ def setUp(self):
3939

4040
def test_group_1(self):
4141
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"])
4443

4544
def test_group_2(self):
4645
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]"])
4947

5048
def test_group_3(self):
5149
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]"])
5551

5652
def test_group_4(self):
5753
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"])
6355
if __name__ == '__main__':
6456
unittest.main()

0 commit comments

Comments
 (0)