fix: IndexError in ensure_file_path_valid when file_path=os.getcwd()

This commit is contained in:
debugtalk
2020-06-14 20:18:58 +08:00
parent ca395b5820
commit f4382139db
2 changed files with 13 additions and 0 deletions

View File

@@ -122,6 +122,16 @@ class TestUtils(unittest.TestCase):
ensure_file_path_valid("examples/postman_echo/request_methods/"),
os.path.join(os.getcwd(), "examples/postman_echo/request_methods"),
)
self.assertEqual(
ensure_file_path_valid(os.path.join(os.getcwd(), "test.yml")),
os.path.join(os.getcwd(), "test.yml"),
)
self.assertEqual(
ensure_file_path_valid(os.getcwd()), os.getcwd(),
)
self.assertEqual(
ensure_file_path_valid(os.getcwd() + ".csv"), os.getcwd() + ".csv",
)
def test_safe_dump_json(self):
class A(object):