def test_single_line(self): raw_list = [ 100, 1688, 3002, 3003, 3004, 3005, 3102, 3103, 3104, 3105, 3802, 3900, 3998, 3999 ] parsed_list = ['100,1688,3002-3005,3102-3105,3802,3900,3998,3999'] self.assertEqual(vlan_parser(raw_list), parsed_list)
def test_multi_line(self): raw_list = [ 100, 1688, 3002, 3004, 3005, 3050, 3102, 3104, 3105, 3151, 3802, 3900, 3998, 3999 ] parsed_list = [ '100,1688,3002,3004,3005,3050,3102,3104,3105,3151', '3802,3900,3998,3999' ] self.assertEqual(vlan_parser(raw_list), parsed_list)
def test_compression(self): raw_list = [1, 2, 3] parsed_list = ['1-3'] self.assertEqual(vlan_parser(raw_list), parsed_list)