kiwi-el8/test/unit/markup/markup_test.py
Alexandre Detiste fb69627ad3
Use unittest.mock from core python everywhere
mock was an independent module that has been merged into the Python standard library.
2024-02-18 22:15:30 +01:00

20 lines
635 B
Python

from unittest.mock import patch
from kiwi.markup import Markup
from kiwi.exceptions import KiwiAnyMarkupPluginError
class TestMarkup:
@patch('kiwi.markup.any.MarkupAny')
def test_MarkupAny(self, mock_MarkupAny):
Markup.new('description')
mock_MarkupAny.assert_called_once_with('description')
@patch('kiwi.markup.xml.MarkupXML')
@patch('kiwi.markup.any.MarkupAny')
def test_MarkupXML(self, mock_MarkupAny, mock_MarkupXML):
mock_MarkupAny.side_effect = KiwiAnyMarkupPluginError('load-error')
Markup.new('description')
mock_MarkupXML.assert_called_once_with('description')