ARver/tests/properties_test.py
arcctgx 872d05d8f7
Some checks are pending
Sync mirrors / sync-gitlab (push) Waiting to run
Sync mirrors / sync-codeberg (push) Waiting to run
Unit tests / unit-tests (3.10) (push) Waiting to run
Unit tests / unit-tests (3.11) (push) Waiting to run
Unit tests / unit-tests (3.12) (push) Waiting to run
Unit tests / unit-tests (3.7) (push) Waiting to run
Unit tests / unit-tests (3.8) (push) Waiting to run
Unit tests / unit-tests (3.9) (push) Waiting to run
rename one test
I forgot to rename it in 7887623.
2025-06-02 20:57:12 +02:00

26 lines
781 B
Python

"""Tests of getting audio file properties."""
# pylint: disable=missing-function-docstring
import os
import unittest
from arver.audio.properties import get_frame_count
CWD = os.path.abspath(os.path.dirname(__file__))
SAMPLE_WAV_PATH = CWD + '/data/samples/sample.wav'
SAMPLE_FLAC_PATH = CWD + '/data/samples/sample.flac'
class TestGetFrameCount(unittest.TestCase):
"""Test getting the number of audio frames."""
expected_frames = 44100 # one second of CDDA audio: number of frames same as sampling rate
def test_wav(self):
frames = get_frame_count(SAMPLE_WAV_PATH)
self.assertEqual(frames, self.expected_frames)
def test_flac(self):
frames = get_frame_count(SAMPLE_FLAC_PATH)
self.assertEqual(frames, self.expected_frames)