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]]))
def community(tokeniser): communities = Communities() value = tokeniser() if value == '[': while True: value = tokeniser() if value == ']': break communities.add(_community(value)) else: communities.add(_community(value)) return communities