예제 #1
0
    def test_index(self):
        """Test the index part of the function."""
        text = 'a\nb\nc'
        expected_pos = [2, 4, -1]
        for res, expected in zip(split_by_newline(text), expected_pos):
            self.assertEqual(res[0], expected)

        text = 'a\nb\nc\n'
        expected_pos = [2, 4, 6, -1]
        for res, expected in zip(split_by_newline(text), expected_pos):
            self.assertEqual(res[0], expected)
예제 #2
0
파일: utils.py 프로젝트: 593in/transifex
    def test_index(self):
        """Test the index part of the function."""
        text = 'a\nb\nc'
        expected_pos = [2, 4, -1]
        for res, expected in zip(split_by_newline(text), expected_pos):
            self.assertEqual(res[0], expected)

        text = 'a\nb\nc\n'
        expected_pos = [2, 4, 6, -1]
        for res, expected in zip(split_by_newline(text), expected_pos):
            self.assertEqual(res[0], expected)
예제 #3
0
 def test_ends_character(self):
     """Test the behavior in case the text does not end
     with a new line character.
     """
     text = 'A line\nAnother line\nAnd a final one.'
     expected_res = text.split('\n')
     for res, expected in zip(split_by_newline(text), expected_res):
         self.assertEqual(res[1], expected)
예제 #4
0
파일: utils.py 프로젝트: 593in/transifex
 def test_ends_character(self):
     """Test the behavior in case the text does not end
     with a new line character.
     """
     text = 'A line\nAnother line\nAnd a final one.'
     expected_res = text.split('\n')
     for res, expected in zip(split_by_newline(text), expected_res):
         self.assertEqual(res[1], expected)
예제 #5
0
 def test_empty_text(self):
     """Test with empty text."""
     it = split_by_newline('')
     _, s = it.next()
     self.assertEqual(s, '')
     self.assertRaises(StopIteration, it.next)
예제 #6
0
파일: utils.py 프로젝트: 593in/transifex
 def test_empty_text(self):
     """Test with empty text."""
     it = split_by_newline('')
     _, s = it.next()
     self.assertEqual(s, '')
     self.assertRaises(StopIteration, it.next)