Esempio n. 1
0
    def test_get_no_cell_references(self):
        '''Should find no references in a regular HTML comment.'''
        no_references = tools.get_cell_reference_patterns({'source':'''!<--
a
b
c
-->''', 'cell_type':'markdown'})
        self.assertEqual(len(no_references), 0)
Esempio n. 2
0
    def test_get_cell_reference_patterns_precode_backticks(self):
        '''Should find three references in a fenced code block.''' 
        cell = {'cell_type':'markdown', 'source':'''```c
a
b/
#comment
```'''}
        references = tools.get_cell_reference_patterns(cell)
        self.assertTrue('a' in references and 'b/' in references and 'c' in references, str(references))
        self.assertEqual(len(references), 3, str(references))
Esempio n. 3
0
    def test_get_cell_reference_patterns_precode_mdcomment(self):
        '''Should find two references and ignore a comment in a fenced code block.'''
        cell = {'cell_type':'markdown', 'source':'''```
a
b/
#comment
```'''}
        references = tools.get_cell_reference_patterns(cell)
        self.assertTrue('a' in references and 'b/' in references, str(references))
        self.assertEqual(len(references), 2, str(references))
Esempio n. 4
0
    def test_get_cell_reference_patterns_precode(self):
        '''Should find no references in a fenced code block in a *code* cell.'''
        self.assertTrue(tools.get_cell_reference_patterns)
        no_references = tools.get_cell_reference_patterns({'source':'''```
foo
bar
baz
```
''', 'cell_type':'code'})
        self.assertEqual(len(no_references), 0)
Esempio n. 5
0
    def test_get_cell_reference_patterns_comment_trailing_filename(self):
        '''Should find three references within an HTML comment.'''
        cell = {'cell_type':'markdown', 'source':'''<!--associate:c
a
b/
#comment
-->'''}
        references = tools.get_cell_reference_patterns(cell)
        self.assertTrue('a' in references and 'b/' in references and 'c' in references, str(references))
        self.assertEqual(len(references), 3, str(references))
Esempio n. 6
0
    def test_get_cell_reference_patterns_comment_multiline(self):
        '''Should find two references and ignore a comment within an HTML comment.'''
        cell = {'cell_type':'markdown', 'source':'''<!--associate:
a
b/
#comment
-->'''}
        references = tools.get_cell_reference_patterns(cell)
        self.assertTrue('a' in references and 'b/' in references, str(references))
        self.assertEqual(len(references), 2, str(references))