예제 #1
0
파일: rgio.py 프로젝트: CreamyCookie/rgain3
 def accessor(self, filename) -> BaseTagReaderWriter:
     ext = extension_for_file(filename)
     if ext in self.more_mappings:
         return self.more_mappings[ext]
     elif ext in self.BASE_MAP:
         return self.BASE_MAP[ext]
     raise UnknownFiletype(ext)
예제 #2
0
def test_extension_for_file_fallback(tmpdir):
    path = tmpdir / "testfile.iso"
    with open(str(path), "wb") as fp:
        fp.write(os.urandom(1024))
    extension_for_file(str(path)) == "iso"
예제 #3
0
def test_extension_for_file_does_not_exist():
    path = Path(__file__).parent / "data" / uuid.uuid4().hex
    with pytest.raises(FileNotFoundError):
        extension_for_file(str(path))
예제 #4
0
def test_extension_for_file(filename, filetype):
    path = Path(__file__).parent / "data" / filename
    assert extension_for_file(str(path)) == filetype
예제 #5
0
파일: rgio.py 프로젝트: CreamyCookie/rgain3
 def is_supported(self, filename) -> bool:
     ext = extension_for_file(filename)
     return ext in self.BASE_MAP or ext in self.more_mappings