当前位置: 首页>>代码示例>>Python>>正文


Python SoftLayer.CLI类代码示例

本文整理汇总了Python中SoftLayer.CLI的典型用法代码示例。如果您正苦于以下问题:Python CLI类的具体用法?Python CLI怎么用?Python CLI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CLI类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_init

    def test_init(self):
        l = cli.listing([1, 'two'], separator=':')
        self.assertEqual([1, 'two'], list(l))
        self.assertEqual(':', l.separator)

        l = cli.listing([])
        self.assertEqual(',', l.separator)
开发者ID:perfectsine,项目名称:softlayer-python,代码行数:7,代码来源:helper_tests.py

示例2: test_str

    def test_str(self):
        l = cli.listing([1, 'two'])
        result = str(l)
        self.assertEqual('1,two', result)

        l = cli.listing((x for x in [1, 'two']), separator=':')
        result = str(l)
        self.assertEqual('1:two', result)
开发者ID:perfectsine,项目名称:softlayer-python,代码行数:8,代码来源:helper_tests.py

示例3: test_to_python

    def test_to_python(self):
        l = cli.listing([1, 'two'])
        result = l.to_python()
        self.assertEqual([1, 'two'], result)

        l = cli.listing(x for x in [1, 'two'])
        result = l.to_python()
        self.assertEqual([1, 'two'], result)
开发者ID:perfectsine,项目名称:softlayer-python,代码行数:8,代码来源:helper_tests.py

示例4: test_transaction_status_missing

    def test_transaction_status_missing(self):
        b = cli.blank()

        result = cli.transaction_status({
            'transactionStatus': {}
        })
        self.assertIsInstance(result, cli.FormattedItem)
        self.assertEqual(result.original, b.original)
开发者ID:MayaY2014,项目名称:softlayer-python,代码行数:8,代码来源:helper_tests.py

示例5: test_do_or_die

    def test_do_or_die(self, raw_input_mock):
        confirmed = '37347373737'
        raw_input_mock.return_value = confirmed
        result = cli.no_going_back(confirmed)
        self.assertTrue(result)

        confirmed = None
        raw_input_mock.return_value = ''
        result = cli.no_going_back(confirmed)
        self.assertFalse(result)
开发者ID:quiteliderally,项目名称:softlayer-api-python-client,代码行数:10,代码来源:helper_tests.py

示例6: test_active_txn_missing

    def test_active_txn_missing(self):
        """ a dict with activeTransaction but not transactionStatus
            should return blank() instead of raising an exception"""
        b = cli.blank()

        result = cli.active_txn({
            'activeTransaction': {}
        })
        self.assertIsInstance(result, cli.FormattedItem)
        self.assertEquals(result.original, b.original)
开发者ID:MayaY2014,项目名称:softlayer-python,代码行数:10,代码来源:helper_tests.py

示例7: test_confirmation

    def test_confirmation(self, raw_input_mock):
        raw_input_mock.return_value = 'Y'
        res = cli.confirm('Confirm?', default=False)
        self.assertTrue(res)

        raw_input_mock.return_value = 'N'
        res = cli.confirm('Confirm?', default=False)
        self.assertFalse(res)

        raw_input_mock.return_value = ''
        res = cli.confirm('Confirm?', default=True)
        self.assertTrue(res)
开发者ID:quiteliderally,项目名称:softlayer-api-python-client,代码行数:12,代码来源:helper_tests.py

示例8: test_gb

    def test_gb(self):
        item = cli.gb(2)
        self.assertEqual(2048, item.original)
        self.assertEqual('2G', item.formatted)

        item = cli.gb('2')
        self.assertEqual(2048, item.original)
        self.assertEqual('2G', item.formatted)

        item = cli.gb('2.0')
        self.assertEqual(2048, item.original)
        self.assertEqual('2G', item.formatted)
开发者ID:perfectsine,项目名称:softlayer-python,代码行数:12,代码来源:helper_tests.py

示例9: test_mb_to_gb

    def test_mb_to_gb(self):
        item = cli.mb_to_gb(1024)
        self.assertEqual(1024, item.original)
        self.assertEqual('1G', item.formatted)

        item = cli.mb_to_gb('1024')
        self.assertEqual('1024', item.original)
        self.assertEqual('1G', item.formatted)

        item = cli.mb_to_gb('1025.0')
        self.assertEqual('1025.0', item.original)
        self.assertEqual('1G', item.formatted)

        self.assertRaises(ValueError, cli.mb_to_gb, '1024string')
开发者ID:quiteliderally,项目名称:softlayer-api-python-client,代码行数:14,代码来源:helper_tests.py

示例10: test_do_or_die

    def test_do_or_die(self, raw_input_mock):
        confirmed = '37347373737'
        raw_input_mock.return_value = confirmed
        result = cli.no_going_back(confirmed)
        self.assertTrue(result)

        # no_going_back should cast int's to str()
        confirmed = '4712309182309'
        raw_input_mock.return_value = confirmed
        result = cli.no_going_back(int(confirmed))
        self.assertTrue(result)

        confirmed = None
        raw_input_mock.return_value = ''
        result = cli.no_going_back(confirmed)
        self.assertFalse(result)
开发者ID:perfectsine,项目名称:softlayer-python,代码行数:16,代码来源:helper_tests.py

示例11: test_transaction_status

 def test_transaction_status(self):
     result = cli.transaction_status({
         'transactionStatus': {
             'name': 'a',
             'friendlyName': 'b'
         }
     })
     self.assertEquals(result.original, 'a')
     self.assertEquals(result.formatted, 'b')
     self.assertIsInstance(result, cli.FormattedItem)
开发者ID:MayaY2014,项目名称:softlayer-python,代码行数:10,代码来源:helper_tests.py


注:本文中的SoftLayer.CLI类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。