예제 #1
0
 def test_simple_split(self):
     self.assertEqual(list(cast.my_split('1,2,3,4')),
                      ['1','2','3','4'])
     self.assertEqual(list(cast.my_split('1,"2,3",4')),
                      ['1','"2,3"','4'])
     self.assertEqual(list(cast.my_split("1,'2,3',4")),
                      ['1',"'2,3'",'4'])
예제 #2
0
 def test_complex_split(self):
     long_str = 'PROGRAM-ID=1,BANDWIDTH=602230,CODECS="avc1.66.31, mp4a.40.2",RESOLUTION=320x240'
     exp_res = [
         'PROGRAM-ID=1', 'BANDWIDTH=602230',
         'CODECS="avc1.66.31, mp4a.40.2"', 'RESOLUTION=320x240'
     ]
     self.assertEqual(list(cast.my_split(long_str)), exp_res)
예제 #3
0
 def test_single_item(self):
     self.assertEqual(list(cast.my_split('test')), ['test'])
예제 #4
0
 def test_trailing_comma(self):
     self.assertEqual(list(cast.my_split('1,2,3,')), ['1', '2', '3'])
예제 #5
0
 def test_single_item(self):
     self.assertEqual(list(cast.my_split('test')), ['test'])
예제 #6
0
 def test_trailing_comma(self):
     self.assertEqual(list(cast.my_split('1,2,3,')), ['1','2','3'])
예제 #7
0
 def test_complex_split(self):
     long_str = 'PROGRAM-ID=1,BANDWIDTH=602230,CODECS="avc1.66.31, mp4a.40.2",RESOLUTION=320x240'
     exp_res = ['PROGRAM-ID=1','BANDWIDTH=602230',
                'CODECS="avc1.66.31, mp4a.40.2"','RESOLUTION=320x240']
     self.assertEqual(list(cast.my_split(long_str)),exp_res)