Ejemplo n.º 1
0
 def test_match(self):
     with patch('mistletoe.block_token.TableCell') as mock:
         line = '| cell 1 | cell 2 |\n'
         token = block_token.TableRow(line)
         self.assertEqual(token.row_align, [None])
         next(token.children)
         mock.assert_called_with('cell 1', None)
Ejemplo n.º 2
0
 def test_easy_table_row(self):
     with patch('mistletoe.block_token.TableCell') as mock:
         line = 'cell 1 | cell 2\n'
         token = block_token.TableRow(line)
         self.assertEqual(token.row_align, [None])
         token.children
         mock.assert_has_calls([call('cell 1', None), call('cell 2', None)])
Ejemplo n.º 3
0
 def test_escaped_pipe_in_cell(self):
     with patch('mistletoe.block_token.TableCell') as mock:
         line = '| pipe: `\\|` | cell 2\n'
         token = block_token.TableRow(line, [None, None])
         self.assertEqual(token.row_align, [None, None])
         mock.assert_has_calls(
             [call('pipe: `|`', None),
              call('cell 2', None)])
Ejemplo n.º 4
0
 def test_not_really_escaped_pipe_in_cell(self):
     with patch('mistletoe.block_token.TableCell') as mock:
         line = '|ending with a \\\\|cell 2\n'
         token = block_token.TableRow(line, [None, None])
         self.assertEqual(token.row_align, [None, None])
         mock.assert_has_calls(
             [call('ending with a \\\\', None),
              call('cell 2', None)])
Ejemplo n.º 5
0
 def test_short_row(self):
     with patch('mistletoe.block_token.TableCell') as mock:
         line = '| cell 1 |\n'
         token = block_token.TableRow(line, [None, None])
         self.assertEqual(token.row_align, [None, None])
         mock.assert_has_calls([call('cell 1', None), call('', None)])