diff --git a/tests/test_Config.py b/tests/test_Config.py index 10f700747..57c410f82 100644 --- a/tests/test_Config.py +++ b/tests/test_Config.py @@ -1,6 +1,7 @@ import sys import _setup_test_env # noqa import unittest +from nose.tools import assert_equal, assert_is_instance, assert_in, assert_greater, assert_true, assert_false from pprint import pprint from returnn.config import * from returnn.util import better_exchook @@ -20,16 +21,16 @@ def test_old_format(): ) ) - assert config.has("num_inputs") is True - assert config.has("hidden_type") is True + assert_true(config.has("num_inputs")) + assert_true(config.has("hidden_type")) assert config.int("num_inputs", -1) == 3 assert config.value("hidden_type", "x") == "forward,lstm" assert config.value("hidden_type", "x", index=0) == "forward" assert config.value("hidden_type", "x", index=1) == "lstm" - assert config.list("hidden_type", ["x"]), ["forward" == "lstm"] + assert config.list("hidden_type", ["x"]) == ["forward", "lstm"] - assert config.is_typed("num_inputs") is False - assert config.is_typed("hidden_type") is False + assert_false(config.is_typed("num_inputs")) + assert_false(config.is_typed("hidden_type")) def test_json_format(): @@ -46,19 +47,19 @@ def test_json_format(): ) ) - assert config.has("num_inputs") is True - assert config.has("hidden_type") is True + assert_true(config.has("num_inputs")) + assert_true(config.has("hidden_type")) assert config.int("num_inputs", -1) == 3 assert config.value("hidden_type", "x") == "forward,lstm" assert config.value("hidden_type", "x", index=0) == "forward" assert config.value("hidden_type", "x", index=1) == "lstm" - assert config.list("hidden_type", ["x"]), ["forward" == "lstm"] + assert config.list("hidden_type", ["x"]) == ["forward", "lstm"] - assert config.is_typed("num_inputs") is True - assert config.is_typed("hidden_type") is True - assert isinstance(config.typed_value("num_inputs"), int) - assert isinstance(config.typed_value("hidden_type"), list) - assert config.typed_value("hidden_type"), ["forward" == "lstm"] + assert_true(config.is_typed("num_inputs")) + assert_true(config.is_typed("hidden_type")) + assert_is_instance(config.typed_value("num_inputs"), int) + assert_is_instance(config.typed_value("hidden_type"), list) + assert config.typed_value("hidden_type") == ["forward", "lstm"] def test_py_config(): @@ -73,19 +74,19 @@ def test_py_config(): ) ) - assert config.has("num_inputs") is True - assert config.has("hidden_type") is True + assert_true(config.has("num_inputs")) + assert_true(config.has("hidden_type")) assert config.int("num_inputs", -1) == 3 assert config.value("hidden_type", "x") == "forward,lstm" assert config.value("hidden_type", "x", index=0) == "forward" assert config.value("hidden_type", "x", index=1) == "lstm" - assert config.list("hidden_type", ["x"]), ["forward" == "lstm"] + assert config.list("hidden_type", ["x"]) == ["forward", "lstm"] - assert config.is_typed("num_inputs") is True - assert config.is_typed("hidden_type") is True - assert isinstance(config.typed_value("num_inputs"), int) - assert isinstance(config.typed_value("hidden_type"), list) - assert config.typed_value("hidden_type"), ["forward" == "lstm"] + assert_true(config.is_typed("num_inputs")) + assert_true(config.is_typed("hidden_type")) + assert_is_instance(config.typed_value("num_inputs"), int) + assert_is_instance(config.typed_value("hidden_type"), list) + assert config.typed_value("hidden_type") == ["forward", "lstm"] def test_rnn_init_config_py_global_var():