當前位置: 首頁>>代碼示例>>Python>>正文


Python values.CollectionState類代碼示例

本文整理匯總了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
開發者ID:thefinn93,項目名稱:shinysdr,代碼行數:7,代碼來源:telemetry.py

示例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)
開發者ID:kpreid,項目名稱:shinysdr,代碼行數:7,代碼來源:test_values.py

示例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())
開發者ID:nunb,項目名稱:shinysdr,代碼行數:20,代碼來源:test_values.py

示例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)
開發者ID:kpreid,項目名稱:shinysdr,代碼行數:22,代碼來源:test_values.py

示例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],
		])
開發者ID:WindyCitySDR,項目名稱:shinysdr,代碼行數:23,代碼來源:test_web.py

示例6: setUp

	def setUp(self):
		self.d = {'a': ExportedState()}
		self.object = CollectionState(self.d, dynamic=True)
		StateStreamTestCase.setUp(self)
開發者ID:WindyCitySDR,項目名稱:shinysdr,代碼行數:4,代碼來源:test_web.py

示例7: __init__

 def __init__(self, table, top):
     CollectionState.__init__(self, table)
     self.__top = top
開發者ID:kpreid,項目名稱:shinysdr,代碼行數:3,代碼來源:top.py

示例8: __init__

 def __init__(self):
     self.__aircraft = {}
     self.__interesting_aircraft = {}
     CollectionState.__init__(self, self.__interesting_aircraft, dynamic=True)
開發者ID:gstark307,項目名稱:shinysdr,代碼行數:4,代碼來源:__init__.py

示例9: __init__

 def __init__(self):
     self.table = {}
     CollectionState.__init__(self, self.table, dynamic=True)
開發者ID:nunb,項目名稱:shinysdr,代碼行數:3,代碼來源:test_values.py

示例10: __init__

 def __init__(self):
     self.table = CellDict(dynamic=True)
     CollectionState.__init__(self, self.table)
開發者ID:thefinn93,項目名稱:shinysdr,代碼行數:3,代碼來源:test_values.py

示例11: __init__

 def __init__(self, cap_table, unserializer):
     self.__cap_table = cap_table
     self.__unserializer = unserializer
     CollectionState.__init__(self, cap_table._get_cap_dict())
開發者ID:kpreid,項目名稱:shinysdr,代碼行數:4,代碼來源:roots.py

示例12: __init__

 def __init__(self):
     self.__stations = {}
     CollectionState.__init__(self, self.__stations, dynamic=True)
開發者ID:langxj,項目名稱:shinysdr,代碼行數:3,代碼來源:__init__.py

示例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())
開發者ID:nunb,項目名稱:shinysdr,代碼行數:6,代碼來源:test_values.py

示例14: __init__

	def __init__(self, table, top):
		CollectionState.__init__(self, table, dynamic=True)
		self.__top = top
開發者ID:shadown,項目名稱:shinysdr,代碼行數:3,代碼來源:top.py

示例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)
開發者ID:Analias,項目名稱:shinysdr,代碼行數:6,代碼來源:telemetry.py


注:本文中的shinysdr.values.CollectionState類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。