~ubuntu-branches/ubuntu/trusty/ceilometer/trusty-proposed

« back to all changes in this revision

Viewing changes to ceilometer/tests/test_utils.py

  • Committer: Package Import Robot
  • Author(s): Chuck Short, James Page, Chuck Short
  • Date: 2014-01-23 15:08:11 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20140123150811-1zaismsuyh1hcl8y
Tags: 2014.1~b2-0ubuntu1
[ James Page ]
* d/control: Add python-jsonpath-rw to BD's.
* d/p/fix-setup-requirements.patch: Bump WebOb to support < 1.4.
 (LP: #1261101)

[ Chuck Short ]
* New upstream version.
* debian/control, debian/ceilometer-common.install: Split out
  ceilometer-alarm-evaluator and ceilometer-alarm-notifier into their
  own packages. (LP: #1250002)
* debian/ceilometer-agent-central.logrotate,
  debian/ceilometer-agent-compute.logrotate,
  debian/ceilometer-api.logrotate,
  debian/ceilometer-collector.logrotate: Add logrotate files, 
  thanks to Ahmed Rahal. (LP: #1224223)
* Fix typos in upstart files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
                                 ('nested.a', 'A'),
69
69
                                 ('nested.b', 'B')])
70
70
 
 
71
    def test_recursive_keypairs_with_list_of_dict(self):
 
72
        small = 1
 
73
        big = 1 << 64
 
74
        expected = [('a', 'A'),
 
75
                    ('b', 'B'),
 
76
                    ('nested:list', ['{%d: 99, %dL: 42}' % (small, big)])]
 
77
        # the keys 1 and 1<<64 cause a hash collision on 64bit platforms
 
78
        for nested in [{small: 99, big: 42}, {big: 42, small: 99}]:
 
79
            data = {'a': 'A',
 
80
                    'b': 'B',
 
81
                    'nested': {'list': [nested]}}
 
82
            pairs = list(utils.recursive_keypairs(data))
 
83
            self.assertEqual(pairs, expected)
 
84
 
71
85
    def test_decimal_to_dt_with_none_parameter(self):
72
 
        self.assertEqual(utils.decimal_to_dt(None), None)
 
86
        self.assertIsNone(utils.decimal_to_dt(None))
73
87
 
74
88
    def test_dict_to_kv(self):
75
89
        data = {'a': 'A',