本文整理汇总了Python中shinysdr.values.CollectionState类的典型用法代码示例。如果您正苦于以下问题:Python CollectionState类的具体用法?Python CollectionState怎么用?Python CollectionState使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CollectionState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, time_source=the_reactor):
self.__interesting_objects = CellDict(dynamic=True)
CollectionState.__init__(self, self.__interesting_objects)
self.__objects = {}
self.__expiry_times = {}
self.__time_source = IReactorTime(time_source)
self.__flush_call = None
示例2: test_undefined
def test_undefined(self):
"""no state_insert method defined"""
self.object = CollectionState(CellDict(dynamic=True))
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught -- TODO: Test logging
self.assertEqual([], list(self.object.state().keys()))
self.flushLoggedErrors(ValueError)
示例3: TestStateInsert
class TestStateInsert(unittest.TestCase):
object = None
def test_success(self):
self.object = InsertFailSpecimen()
self.object.state_from_json({'foo': {'fail': False}})
self.assertEqual(['foo'], self.object.state().keys())
def test_failure(self):
self.object = InsertFailSpecimen()
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught
self.assertEqual([], self.object.state().keys())
def test_undefined(self):
'''no state_insert method defined'''
self.object = CollectionState({}, dynamic=True)
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught
self.assertEqual([], self.object.state().keys())
示例4: TestStateInsert
class TestStateInsert(unittest.TestCase):
object = None
def test_success(self):
self.object = InsertFailSpecimen()
self.object.state_from_json({'foo': {'fail': False}})
self.assertEqual(['foo'], list(self.object.state().keys()))
def test_failure(self):
self.object = InsertFailSpecimen()
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught -- TODO: Test logging
self.assertEqual([], list(self.object.state().keys()))
self.flushLoggedErrors(ValueError)
def test_undefined(self):
"""no state_insert method defined"""
self.object = CollectionState(CellDict(dynamic=True))
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught -- TODO: Test logging
self.assertEqual([], list(self.object.state().keys()))
self.flushLoggedErrors(ValueError)
示例5: TestCollectionStream
class TestCollectionStream(StateStreamTestCase):
def setUp(self):
self.d = {'a': ExportedState()}
self.object = CollectionState(self.d, dynamic=True)
StateStreamTestCase.setUp(self)
def test_delete(self):
self.assertEqual(self.getUpdates(), [
['register_block', 1, 'urlroot'],
['register_cell', 2, 'urlroot/a', self.object.state()['a'].description()],
['register_block', 3, 'urlroot/a'],
['value', 3, {}],
['value', 2, 3],
['value', 1, {'a': 2}],
['value', 0, 1],
])
self.assertEqual(self.getUpdates(), [])
del self.d['a']
self.assertEqual(self.getUpdates(), [
['value', 1, {}],
['delete', 2],
['delete', 3],
])
示例6: setUp
def setUp(self):
self.d = {'a': ExportedState()}
self.object = CollectionState(self.d, dynamic=True)
StateStreamTestCase.setUp(self)
示例7: __init__
def __init__(self, table, top):
CollectionState.__init__(self, table)
self.__top = top
示例8: __init__
def __init__(self):
self.__aircraft = {}
self.__interesting_aircraft = {}
CollectionState.__init__(self, self.__interesting_aircraft, dynamic=True)
示例9: __init__
def __init__(self):
self.table = {}
CollectionState.__init__(self, self.table, dynamic=True)
示例10: __init__
def __init__(self):
self.table = CellDict(dynamic=True)
CollectionState.__init__(self, self.table)
示例11: __init__
def __init__(self, cap_table, unserializer):
self.__cap_table = cap_table
self.__unserializer = unserializer
CollectionState.__init__(self, cap_table._get_cap_dict())
示例12: __init__
def __init__(self):
self.__stations = {}
CollectionState.__init__(self, self.__stations, dynamic=True)
示例13: test_undefined
def test_undefined(self):
'''no state_insert method defined'''
self.object = CollectionState({}, dynamic=True)
self.object.state_from_json({'foo': {'fail': True}})
# throws but exception is caught
self.assertEqual([], self.object.state().keys())
示例14: __init__
def __init__(self, table, top):
CollectionState.__init__(self, table, dynamic=True)
self.__top = top
示例15: __init__
def __init__(self, time_source=the_reactor):
self.__interesting_objects = {}
CollectionState.__init__(self, self.__interesting_objects, dynamic=True)
self.__objects = {}
self.__expiry_times = {}
self.__time_source = IReactorTime(time_source)