From b45dcfeee8ed1b60eb1687293adad62d6bb7ecc4 Mon Sep 17 00:00:00 2001 From: luopengting Date: Tue, 8 Sep 2020 09:45:41 +0800 Subject: [PATCH] reduce nbnc in test_get_summary_lineage_exception_2 --- tests/st/func/lineagemgr/test_model.py | 61 +++++++------------------- 1 file changed, 17 insertions(+), 44 deletions(-) diff --git a/tests/st/func/lineagemgr/test_model.py b/tests/st/func/lineagemgr/test_model.py index 9e3e4083..069ecb63 100644 --- a/tests/st/func/lineagemgr/test_model.py +++ b/tests/st/func/lineagemgr/test_model.py @@ -283,33 +283,6 @@ class TestModelApi(TestCase): ['metric', 'fake_name'] ) - self.assertRaisesRegex( - LineageParamTypeError, - 'Keys must be list.', - get_summary_lineage, - None, - SUMMARY_DIR, - 0 - ) - - self.assertRaisesRegex( - LineageParamTypeError, - 'Keys must be list.', - get_summary_lineage, - None, - SUMMARY_DIR, - 0.1 - ) - - self.assertRaisesRegex( - LineageParamTypeError, - 'Keys must be list.', - get_summary_lineage, - None, - SUMMARY_DIR, - True - ) - self.assertRaisesRegex( LineageParamTypeError, 'Element of keys must be str.', @@ -319,23 +292,23 @@ class TestModelApi(TestCase): [1, 2, 3] ) - self.assertRaisesRegex( - LineageParamTypeError, - 'Keys must be list.', - get_summary_lineage, - None, - SUMMARY_DIR, - (3, 4) - ) - - self.assertRaisesRegex( - LineageParamTypeError, - 'Keys must be list.', - get_summary_lineage, - None, - SUMMARY_DIR, - {'a': 'b'} - ) + @pytest.mark.level0 + @pytest.mark.platform_arm_ascend_training + @pytest.mark.platform_x86_gpu_training + @pytest.mark.platform_x86_ascend_training + @pytest.mark.platform_x86_cpu + @pytest.mark.env_single + def test_get_summary_lineage_exception_3(self): + """Test the interface of get_summary_lineage with exception.""" + for keys in [0, 0.1, True, (3, 4), {'a': 'b'}]: + self.assertRaisesRegex( + LineageParamTypeError, + 'Keys must be list.', + get_summary_lineage, + None, + SUMMARY_DIR, + keys + ) @pytest.mark.level0 @pytest.mark.platform_arm_ascend_training