예제 #1
0
 def test_parse_filename_str(self):
     path = os.path.join(data_dir, "test.txt")
     filename, is_url = MediaInfo._parse_filename(path)
     # Windows paths are URLs
     if not os_is_nt:
         self.assertFalse(is_url)
     self.assertEqual(filename, path)
예제 #2
0
 def test_parse_filename_pathlike(self):
     class PathLikeObject(os.PathLike):
         def __fspath__(self):
             return os.path.join(data_dir, "test.txt")
     path = PathLikeObject()
     filename, is_url = MediaInfo._parse_filename(path)
     self.assertFalse(is_url)
     self.assertEqual(filename, os.path.join(data_dir, "test.txt"))
예제 #3
0
 def test_parse_filename_url(self):
     filename, is_url = MediaInfo._parse_filename("https://localhost")
     self.assertTrue(is_url)
예제 #4
0
 def test_parse_filename_pathlib(self):
     pathlib = pytest.importorskip("pathlib")
     path = pathlib.Path(data_dir, "test.txt")
     filename, is_url = MediaInfo._parse_filename(path)
     self.assertFalse(is_url)
     self.assertEqual(filename, os.path.join(data_dir, "test.txt"))