Load local text files of any kind - code, txts, json etc (#1076)

This commit is contained in:
Sidharth Mohanty
2023-12-29 22:26:24 +05:30
committed by GitHub
parent 6df63d9ca7
commit a544b4d3ff
6 changed files with 43 additions and 5 deletions

View File

@@ -85,10 +85,10 @@ class TestApp(unittest.TestCase):
detect_datatype(["foo", "bar"])
@patch("os.path.isfile")
def test_detect_datatype_regular_filesystem_file_not_detected(self, mock_isfile):
def test_detect_datatype_regular_filesystem_file_txt(self, mock_isfile):
with tempfile.NamedTemporaryFile(suffix=".txt", delete=True) as tmp:
mock_isfile.return_value = True
self.assertEqual(detect_datatype(tmp.name), DataType.TEXT)
self.assertEqual(detect_datatype(tmp.name), DataType.TEXT_FILE)
def test_detect_datatype_regular_filesystem_no_file(self):
"""Test that if a filepath is not actually an existing file, it is not handled as a file path."""