File: test_hyperlink_replacement.py

package info (click to toggle)
striprtf 0.0.29-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,488 kB
  • sloc: python: 707; makefile: 2
file content (18 lines) | stat: -rw-r--r-- 542 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import unittest
from pathlib import Path

from striprtf.striprtf import rtf_to_text

RTF_DIR = Path.cwd() / "tests" / "rtf"
TXT_DIR = Path.cwd() / "tests" / "text"


class TestSimple(unittest.TestCase):
    def test_extract_hyperlink(self):
        hyperlink_rtf = RTF_DIR / "hyperlink.rtf"
        hyperlink_txt = TXT_DIR / "hyperlink.txt"

        with hyperlink_rtf.open() as source:
            result = rtf_to_text(source.read())
        with hyperlink_txt.open() as destination:
            self.assertEqual(destination.read(), result)