From 66004441396b4855659cef74340b1815685ecc2f Mon Sep 17 00:00:00 2001 From: Franco Masotti Date: Tue, 16 Apr 2024 19:33:19 +0200 Subject: [PATCH] Fixes - Fix unittest newline separator --- md_toc/tests/tests.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/md_toc/tests/tests.py b/md_toc/tests/tests.py index 3c52c72..62f2dda 100644 --- a/md_toc/tests/tests.py +++ b/md_toc/tests/tests.py @@ -21,6 +21,7 @@ r"""The tests module.""" import doctest +import os import unittest from unittest.mock import patch @@ -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')