diff --git a/CHANGELOG.md b/CHANGELOG.md index 511754d..e542d86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - `engine` parameter added to `play` function - `engine` parameter added to `NavaThread` class - `README.md` modified +- Test system modified - `__play_win` function renamed to `__play_winsound` - `__play_mac` function renamed to `__play_afplay` - `__play_linux` function renamed to `__play_alsa` diff --git a/test/error_test.py b/test/error_test.py index 03169f4..c223720 100644 --- a/test/error_test.py +++ b/test/error_test.py @@ -2,6 +2,7 @@ """ >>> import os >>> from nava import play, stop +>>> test_sound_path = os.path.join("others", "test.wav") >>> play("test.wav") Traceback (most recent call last): ... @@ -14,11 +15,11 @@ Traceback (most recent call last): ... nava.errors.NavaBaseError: Given sound id doesn't exist. ->>> play(os.path.join("others", "test.wav"), async_mode=False, loop=True) +>>> play(test_sound_path, async_mode=False, loop=True) Traceback (most recent call last): ... nava.errors.NavaBaseError: `loop` can not be set True when `async_mode` is False. ->>> play(os.path.join("others", "test.wav"), async_mode=True, loop=True, engine=2) +>>> play(test_sound_path, async_mode=True, loop=True, engine=2) Traceback (most recent call last): ... nava.errors.NavaBaseError: `engine` type must be `Engine` enum. diff --git a/test/function_test.py b/test/function_test.py index 4708fe6..6ec62e9 100644 --- a/test/function_test.py +++ b/test/function_test.py @@ -4,23 +4,24 @@ >>> import sys >>> import time >>> import nava ->>> nava.play(os.path.join("others", "test.wav")) ->>> sound_id_1 = nava.play(os.path.join("others", "test.wav"), async_mode=True) +>>> test_sound_path = os.path.join("others", "test.wav") +>>> nava.play(test_sound_path) +>>> sound_id_1 = nava.play(test_sound_path, async_mode=True) >>> sound_id_1 == 1001 True ->>> sound_id_2 = nava.play(os.path.join("others", "test.wav"), async_mode=True) +>>> sound_id_2 = nava.play(test_sound_path, async_mode=True) >>> sound_id_2 == 1002 True ->>> sound_id_3 = nava.play(os.path.join("others", "test.wav"), async_mode=True) +>>> sound_id_3 = nava.play(test_sound_path, async_mode=True) >>> sound_id_3 == 1003 True ->>> sound_id_4 = nava.play(os.path.join("others", "test.wav"), async_mode=True, loop=True) +>>> sound_id_4 = nava.play(test_sound_path, async_mode=True, loop=True) >>> sound_id_4 == 1004 True >>> nava.stop(sound_id_1) >>> nava.stop(sound_id_4) >>> for i in range(40): -... sound_id = nava.play(os.path.join("others", "test.wav"), async_mode=True) +... sound_id = nava.play(test_sound_path, async_mode=True) ... time.sleep(0.2) >>> time.sleep(1) >>> nava.stop_all() @@ -30,12 +31,12 @@ True >>> sys_platform = sys.platform >>> if sys_platform == "win32": -... sound_id = nava.play(os.path.join("others", "test.wav"), async_mode=True, engine=nava.Engine.WINSOUND) +... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.WINSOUND) ... elif sys_platform == "darwin": -... sound_id = nava.play(os.path.join("others", "test.wav"), async_mode=True, engine=nava.Engine.AFPLAY) +... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.AFPLAY) ... else: -... sound_id = nava.play(os.path.join("others", "test.wav"), async_mode=True, engine=nava.Engine.ALSA) ->>> nava.functions.play_cli(os.path.join("others", "test.wav")) +... sound_id = nava.play(test_sound_path, async_mode=True, engine=nava.Engine.ALSA) +>>> nava.functions.play_cli(test_sound_path) >>> nava.functions.nava_help() A Python library for playing sound everywhere natively and securely.