Ejemplo n.º 1
0
 def test_4_community(self):
     communities = Communities()
     community = to_Community('1:1')
     communities.add(community)
     self.assertEqual(
         communities.pack(), ''.join(
             [chr(c) for c in [0xc0, 0x08, 0x04, 0x00, 0x01, 0x00, 0x01]]))
Ejemplo n.º 2
0
 def __new_communities(self, data):
     communities = Communities()
     while data:
         if data and len(data) < 4:
             raise Notify(3, 1, "could not decode community %s" % str([hex(ord(_)) for _ in data]))
         communities.add(cachedCommunity(data[:4]))
         data = data[4:]
     return communities
Ejemplo n.º 3
0
 def __new_communities(self, data):
     communities = Communities()
     while data:
         if data and len(data) < 4:
             raise Notify(
                 3, 1, 'could not decode community %s' %
                 str([hex(ord(_)) for _ in data]))
         communities.add(cachedCommunity(data[:4]))
         data = data[4:]
     return communities
Ejemplo n.º 4
0
	def test_4_community (self):
		communities = Communities()
		community = to_Community('1:1')
		communities.add(community)
		self.assertEqual(communities.pack(),''.join([chr(c) for c in [0xc0,0x08,0x04,0x00,0x01,0x00,0x01]]))