test_ludq_utils_v2.py 1021 Bytes
Newer Older
qunfeng qiu's avatar
qunfeng qiu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
"""
@Version: 1.0
@Python Version:3.6.6
@Author: ludq1
@File: test_ludq_utils_v2.py
@Time: 2021/05/04 22:01
@Description: 测试代码
"""
import unittest
from unittest import TestCase, main

from cucc_common_pkg.ludq_utils.utils_v2 import UtilityV2


class TestUtility(TestCase):
    r'''
    TestUtility
    '''

    @unittest.skipIf(False, '需正确设置accessToken,vpc_name_full,account_id,region_code后测试')
    def test_load_yaml(self):
        r'''

        Returns:

        '''
        yaml_str = """
        a: 1
        b:
         c1: c1
         c2: 中文
        """
        ret_obj = UtilityV2().yaml_load(yaml_str)
        print(ret_obj)
        self.assertEqual(ret_obj.get("a"), 1)
        self.assertTrue(isinstance(ret_obj.get("b"), dict))
        self.assertEqual(ret_obj.get("b").get("c1"), "c1")
        self.assertEqual(ret_obj.get("b").get("c2"), "中文")


if __name__ == '__main__':
    main()