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


Python Gauged.keys方法代码示例

本文整理汇总了Python中gauged.Gauged.keys方法的典型用法代码示例。如果您正苦于以下问题:Python Gauged.keys方法的具体用法?Python Gauged.keys怎么用?Python Gauged.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gauged.Gauged的用法示例。


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

示例1: test_context_defaults

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import keys [as 别名]
 def test_context_defaults(self):
     gauged = Gauged(self.driver, resolution=1000, block_size=10000)
     with gauged.writer as writer:
         writer.add('bar', 123, timestamp=10000)
         writer.add('foo', 456, timestamp=20000)
     self.assertEqual(gauged.keys(), ['bar', 'foo'])
     gauged = Gauged(self.driver, resolution=1000, block_size=10000,
                     defaults={'limit': 1})
     self.assertEqual(gauged.keys(), ['bar'])
开发者ID:chriso,项目名称:gauged,代码行数:11,代码来源:test_gauged.py

示例2: test_gauge

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import keys [as 别名]
 def test_gauge(self):
     gauged = Gauged(self.driver, block_size=50000, gauge_nan=Gauged.IGNORE)
     self.assertEqual(gauged.value('foobar'), None)
     with gauged.writer as writer:
         writer.add('foobar', 200, timestamp=23000)
     self.assertEqual(gauged.value('foobar'), 200)
     self.assertEqual(gauged.value('foobar', timestamp=22000), None)
     with gauged.writer as writer:
         writer.add({'foobar': 300, 'invalid': 'nan'}, timestamp=50000)
     self.assertEqual(gauged.value('foobar'), 300)
     self.assertEqual(gauged.value('foobar', 30000), 200)
     timestamp = datetime.datetime(
         1970, 1, 1) + datetime.timedelta(seconds=60)
     self.assertEqual(gauged.value('foobar', timestamp), 300)
     with gauged.writer as writer:
         writer.add({'foobar': 350}, timestamp=90000)
         writer.add('foobar', 100, timestamp=120000)
         writer.add('bar', 150, timestamp=130000)
     self.assertItemsEqual(gauged.keys(), ['foobar', 'bar'])
     self.assertEqual(gauged.value('foobar'), 100)
     with gauged.writer as writer:
         writer.add('foobar', 500, timestamp=150000)
     self.assertEqual(gauged.value('foobar'), 500)
     with gauged.writer as writer:
         writer.add('foobar', 1500, timestamp=10000, namespace=1)
     self.assertEqual(gauged.value('foobar', namespace=1), 1500)
     self.assertEqual(gauged.value('foobar'), 500)
     with gauged.writer as writer:
         writer.clear_from(100000)
     self.assertEqual(gauged.value('foobar'), 350)
     with self.assertRaises(GaugedDateRangeError):
         self.assertEqual(
             gauged.value('foobar', timestamp=-10000000000000), None)
开发者ID:pyarnold,项目名称:gauged,代码行数:35,代码来源:test_gauged.py

示例3: test_no_data

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import keys [as 别名]
 def test_no_data(self):
     gauged = Gauged(self.driver)
     self.assertEqual(len(gauged.namespaces()), 0)
     self.assertEqual(len(gauged.value_series('foo')), 0)
     self.assertEqual(len(gauged.aggregate_series('foo', Gauged.SUM)), 0)
     self.assertEqual(gauged.value('foo'), None)
     self.assertEqual(gauged.aggregate('foo', Gauged.SUM), None)
     self.assertEqual(len(gauged.keys()), 0)
     stats = gauged.statistics()
     for attr in ['data_points', 'byte_count']:
         self.assertEqual(getattr(stats, attr), 0)
开发者ID:pyarnold,项目名称:gauged,代码行数:13,代码来源:test_gauged.py

示例4: test_keys

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import keys [as 别名]
 def test_keys(self):
     gauged = Gauged(self.driver)
     with gauged.writer as writer:
         writer.add('foobar', 1, timestamp=1000)
         writer.add('foobaz', 1, timestamp=1000)
         writer.add('bar', 1, timestamp=1000, namespace=1)
     self.assertListEqual(gauged.keys(), ['foobar', 'foobaz'])
     self.assertListEqual(gauged.keys(prefix='bar'), [])
     self.assertListEqual(gauged.keys(namespace=1), ['bar'])
     self.assertListEqual(gauged.keys(namespace=1, prefix='bar'), ['bar'])
     self.assertListEqual(gauged.keys(limit=1), ['foobar'])
     self.assertListEqual(gauged.keys(limit=1, offset=1), ['foobaz'])
开发者ID:pyarnold,项目名称:gauged,代码行数:14,代码来源:test_gauged.py

示例5: test_gauged_init_store

# 需要导入模块: from gauged import Gauged [as 别名]
# 或者: from gauged.Gauged import keys [as 别名]
 def test_gauged_init_store(self):
     gauged = Gauged('sqlite+foo://')
     self.assertEqual(len(gauged.metadata()), 0)
     with self.assertRaises(GaugedSchemaError):
         gauged.keys()
开发者ID:pyarnold,项目名称:gauged,代码行数:7,代码来源:test_gauged.py


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