mirror of
https://github.com/iluvcapra/wavinfo.git
synced 2026-10-01 17:27:42 +00:00
Added test file, Ruff pass
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
from . import test_wave_parsing
|
||||
|
||||
from io import BytesIO
|
||||
from typing import Generator
|
||||
import zipfile as zf
|
||||
import os.path
|
||||
import os
|
||||
from contextlib import contextmanager
|
||||
|
||||
# class TestFileLoader:
|
||||
# """
|
||||
# This guy manages the test_files archive.
|
||||
# """
|
||||
|
||||
# def __init__(self, test_file_arch_name = 'archive.zip') -> None:
|
||||
# self.base_path = os.path.join(os.path.dirname(__file__), "test_files")
|
||||
# self.test_file_arch_name = test_file_arch_name
|
||||
# self._gather_test_files_into_archive()
|
||||
|
||||
# @property
|
||||
# def arch_path(self):
|
||||
# return os.path.join(self.base_path, self.test_file_arch_name)
|
||||
|
||||
# @contextmanager
|
||||
# def open(self, name) -> Generator[BytesIO]:
|
||||
# z = zf.ZipFile(self.arch_path, 'r')
|
||||
# member = z.open(name, 'r')
|
||||
# try:
|
||||
# yield member
|
||||
# finally:
|
||||
# zf.close()
|
||||
|
||||
# def _gather_test_files_into_archive(self):
|
||||
# with zf.ZipFile(self.arch_path, 'a') as zip:
|
||||
# for root, _, files in os.walk(self.base_path):
|
||||
# for name in files:
|
||||
# if root == self.base_path and name == self.test_file_arch_name:
|
||||
# continue
|
||||
# else:
|
||||
# p = os.path.join(root, name)
|
||||
# zip.write(p)
|
||||
# os.unlink(p)
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
from unittest import TestCase
|
||||
from glob import glob
|
||||
from unittest import TestCase
|
||||
|
||||
import wavinfo
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
from unittest import TestCase
|
||||
|
||||
import wavinfo
|
||||
from wavinfo.wave_dbmd_reader import SegmentType, DolbyDigitalPlusMetadata
|
||||
from wavinfo.wave_dbmd_reader import DolbyDigitalPlusMetadata, SegmentType
|
||||
|
||||
|
||||
class TestDolby(TestCase):
|
||||
|
||||
Binary file not shown.
+8
-10
@@ -1,28 +1,26 @@
|
||||
import glob
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
from wavinfo.__main__ import main
|
||||
|
||||
import sys
|
||||
import glob
|
||||
|
||||
|
||||
class MainTest(unittest.TestCase):
|
||||
def test_empty_argv(self):
|
||||
with patch.object(sys, "argv", []):
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
self.fail("main() throwing an exception")
|
||||
except Exception as e:
|
||||
self.fail(f"main() throwing an exception: {e}")
|
||||
|
||||
def test_a_file(self):
|
||||
for path in glob.glob("tests/test_files/**/*.wav"):
|
||||
with patch.object(sys, "argv", ["TEST", path]):
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
self.fail("main() throwing an exception")
|
||||
except Exception as e:
|
||||
self.fail(f"main() throwing an exception: {e}")
|
||||
|
||||
def test_ixml(self):
|
||||
with patch.object(
|
||||
@@ -30,5 +28,5 @@ class MainTest(unittest.TestCase):
|
||||
):
|
||||
try:
|
||||
main()
|
||||
except:
|
||||
self.fail("main() throwing an exception")
|
||||
except Exception as e:
|
||||
self.fail(f"main() throwing an exception: {e}")
|
||||
|
||||
+1
-2
@@ -1,12 +1,11 @@
|
||||
# import os.path
|
||||
import gzip
|
||||
from glob import glob
|
||||
# from typing import Dict, Any, cast
|
||||
|
||||
# from typing import Dict, Any, cast
|
||||
from unittest import TestCase
|
||||
|
||||
# from .utils import all_files, ffprobe
|
||||
|
||||
import wavinfo
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
from unittest import TestCase
|
||||
from glob import glob
|
||||
from unittest import TestCase
|
||||
|
||||
import wavinfo
|
||||
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
import unittest
|
||||
import wavinfo
|
||||
|
||||
import glob
|
||||
import unittest
|
||||
|
||||
import wavinfo
|
||||
|
||||
|
||||
class TestWalk(unittest.TestCase):
|
||||
@@ -29,8 +29,8 @@ class TestWalk(unittest.TestCase):
|
||||
try:
|
||||
for _, _, _ in info.walk():
|
||||
pass
|
||||
except:
|
||||
self.fail(f"Failed to walk metadata in file {file}")
|
||||
except Exception as e:
|
||||
self.fail(f"Failed to walk metadata in file {file}: {e}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import os.path
|
||||
from glob import glob
|
||||
from typing import Dict, Any, cast
|
||||
|
||||
from typing import Any, Dict, cast
|
||||
from unittest import TestCase
|
||||
|
||||
from .utils import all_files, ffprobe
|
||||
|
||||
import wavinfo
|
||||
|
||||
from .utils import all_files, ffprobe
|
||||
|
||||
|
||||
class TestWaveInfo(TestCase):
|
||||
def test_sanity(self):
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
import os.path
|
||||
import sys
|
||||
import json
|
||||
import subprocess
|
||||
from subprocess import PIPE
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
import wavinfo
|
||||
# import wavinfo
|
||||
|
||||
|
||||
class TestZoomF8(TestCase):
|
||||
|
||||
+4
-4
@@ -1,8 +1,8 @@
|
||||
import os.path
|
||||
import sys
|
||||
import subprocess
|
||||
from subprocess import PIPE
|
||||
import json
|
||||
import os.path
|
||||
import subprocess
|
||||
import sys
|
||||
from subprocess import PIPE
|
||||
|
||||
FFPROBE = "ffprobe"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user