self.assertRaises()
import unittest
from my_merge_request import MergeRequestStatus, MergeRequestException, MergeRequest
class TestMergeRequestStatus(unittest.TestCase):
def test_cannot_up_vote_on_closed_merge_request(self):
merge_request = MergeRequest()
merge_request.close()
self.assertRaises(
MergeRequestException,
merge_request.up_vote,
"dev1",
)
self.assertRaiseRegex()
import unittest
from my_merge_request import MergeRequestStatus, MergeRequestException, MergeRequest
def test_cannot_down_vote_on_closed_merge_request(self):
merge_request = MergeRequest()
merge_request.close()
self.assertRaisesRegex(
Exception,
r"종료된 머지 리퀘스트에 투표할 수 없음",
merge_request.down_vote,
"dev1"
)
Reference