Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
- Fix unittest newline separator
  • Loading branch information
frnmst committed Apr 16, 2024
1 parent 276acd6 commit 6600444
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions md_toc/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
r"""The tests module."""

import doctest
import os
import unittest
from unittest.mock import patch

Expand Down Expand Up @@ -851,13 +852,14 @@ def test_build_toc(self):
with open('foo.md', 'w') as f:
f.write('# This\n# Is an\n## Example\n')
self.assertEqual(
api.build_toc('foo.md'),
'- [This](#this)\n- [Is an](#is-an)\n - [Example](#example)\n')

api.build_toc('foo.md'), ''.join([
'- [This](#this)', os.linesep, '- [Is an](#is-an)', os.linesep,
' - [Example](#example)', os.linesep
]))
with open('foo.md', 'w') as f:
f.write('# This\n# Is an\n## Example\n')
self.assertEqual(api.build_toc('foo.md', skip_lines=2),
'- [Example](#example)\n')
''.join(['- [Example](#example)', os.linesep]))

with open('foo.md', 'w') as f:
f.write('# This\n')
Expand Down

0 comments on commit 6600444

Please sign in to comment.