コード例 #1
0
ファイル: test_block_token.py プロジェクト: aguai/docook
 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)
コード例 #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)])
コード例 #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)])
コード例 #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)])
コード例 #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)])