From 2cadd3e76175504ebdb0cfb41d057786ff3aa4b6 Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Wed, 11 Aug 2021 01:42:09 +0900 Subject: [PATCH 1/4] Add tests for HTSLabelFile --- setup.py | 2 +- tests/test_io.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 7d48966..224c8da 100644 --- a/setup.py +++ b/setup.py @@ -163,7 +163,7 @@ def package_files(directory): tests_require=["nose", "coverage"], extras_require={ "docs": ["numpydoc", "sphinx_rtd_theme"], - "test": ["nose", "pyworld", "librosa"], + "test": ["nose", "pyworld", "librosa", "pyopenjtalk"], "lint": [ "pysen", "types-setuptools", diff --git a/tests/test_io.py b/tests/test_io.py index e13480d..4d08390 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -2,6 +2,7 @@ import re from os.path import dirname, join +import pyopenjtalk from nnmnkwii.frontend import merlin as fe from nnmnkwii.io import hts from nnmnkwii.util import example_question_file @@ -222,6 +223,18 @@ def test_create_from_contexts(): labels2 = hts.HTSLabelFile.create_from_contexts(contexts) assert str(labels), str(labels2) + @raises(ValueError) + def test_empty_context(): + hts.HTSLabelFile.create_from_contexts("") + + @raises(ValueError) + def test_empty_context2(): + contexts = pyopenjtalk.extract_fullcontext("") + hts.HTSLabelFile.create_from_contexts(contexts) + + test_empty_context() + test_empty_context2() + def test_lab_in_sec(): labels1 = hts.load(join(DATA_DIR, "BASIC5000_0619_head.lab")) From e998b5171d5aada96051355cc3d7485e9034e175 Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Wed, 11 Aug 2021 02:19:47 +0900 Subject: [PATCH 2/4] fix windows CI --- setup.py | 2 +- tests/test_io.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 224c8da..7d48966 100644 --- a/setup.py +++ b/setup.py @@ -163,7 +163,7 @@ def package_files(directory): tests_require=["nose", "coverage"], extras_require={ "docs": ["numpydoc", "sphinx_rtd_theme"], - "test": ["nose", "pyworld", "librosa", "pyopenjtalk"], + "test": ["nose", "pyworld", "librosa"], "lint": [ "pysen", "types-setuptools", diff --git a/tests/test_io.py b/tests/test_io.py index 4d08390..0dec6d2 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -2,7 +2,6 @@ import re from os.path import dirname, join -import pyopenjtalk from nnmnkwii.frontend import merlin as fe from nnmnkwii.io import hts from nnmnkwii.util import example_question_file @@ -229,6 +228,10 @@ def test_empty_context(): @raises(ValueError) def test_empty_context2(): + try: + import pyopenjtalk + except ImportError: + return contexts = pyopenjtalk.extract_fullcontext("") hts.HTSLabelFile.create_from_contexts(contexts) From 2e929fef53c60fef8e6ef4d08aa0f3d6ea2ee77c Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Wed, 11 Aug 2021 02:29:47 +0900 Subject: [PATCH 3/4] fix --- tests/test_io.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/tests/test_io.py b/tests/test_io.py index 0dec6d2..695ba5e 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -228,15 +228,16 @@ def test_empty_context(): @raises(ValueError) def test_empty_context2(): - try: - import pyopenjtalk - except ImportError: - return + import pyopenjtalk contexts = pyopenjtalk.extract_fullcontext("") hts.HTSLabelFile.create_from_contexts(contexts) test_empty_context() - test_empty_context2() + try: + import pyopenjtalk # noqa + test_empty_context2() + except ImportError: + return def test_lab_in_sec(): From 394566d8883797945154d67b1f36b4a84346c079 Mon Sep 17 00:00:00 2001 From: Ryuichi Yamamoto Date: Wed, 11 Aug 2021 02:36:08 +0900 Subject: [PATCH 4/4] fix lint --- tests/test_io.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/test_io.py b/tests/test_io.py index 695ba5e..c2b6146 100644 --- a/tests/test_io.py +++ b/tests/test_io.py @@ -7,6 +7,11 @@ from nnmnkwii.util import example_question_file from nose.tools import raises +try: + import pyopenjtalk # noqa +except ImportError: + pass + DATA_DIR = join(dirname(__file__), "data") @@ -228,16 +233,16 @@ def test_empty_context(): @raises(ValueError) def test_empty_context2(): - import pyopenjtalk contexts = pyopenjtalk.extract_fullcontext("") hts.HTSLabelFile.create_from_contexts(contexts) test_empty_context() try: import pyopenjtalk # noqa + test_empty_context2() except ImportError: - return + pass def test_lab_in_sec():