| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
""" |
| 9 |
test get_writer_class |
| 10 |
""" |
| 11 |
|
| 12 |
from pathlib import Path |
| 13 |
import sys |
| 14 |
import unittest |
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
DOCUTILS_ROOT = Path(__file__).resolve().parents[2] |
| 21 |
if str(DOCUTILS_ROOT) not in sys.path: |
| 22 |
sys.path.insert(0, str(DOCUTILS_ROOT)) |
| 23 |
|
| 24 |
from docutils.writers import get_writer_class |
| 25 |
|
| 26 |
|
| 27 |
class GetWriterClassTestCase(unittest.TestCase): |
| 28 |
|
| 29 |
def test_registered_writer(self): |
| 30 |
get_writer_class('manpage') |
| 31 |
|
| 32 |
|
| 33 |
def test_bogus_writer(self): |
| 34 |
with self.assertRaises(ImportError): |
| 35 |
get_writer_class('nope') |
| 36 |
|
| 37 |
def test_local_writer(self): |
| 38 |
|
| 39 |
get_writer_class('test.local-writer') |
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
if __name__ == '__main__': |
| 44 |
unittest.main() |