Skip to content

Commit 6529abf

Browse files
committed
Moved test file
1 parent 3512d82 commit 6529abf

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/test/test.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import re
2+
import unittest
3+
import unittest
4+
from src.main import cli
5+
6+
7+
class TestMessageEmpty(unittest.TestCase):
8+
def test_empty_message_should_fail(self):
9+
result = cli.message_not_empty(" \n")()
10+
self.assertEqual(result.is_passing(), False)
11+
12+
def test_full_message_should_pass(self):
13+
result = cli.message_not_empty("I am a whole message")()
14+
self.assertEqual(result.is_passing(), True)
15+
16+
17+
class TestMessagePatternMatch(unittest.TestCase):
18+
def test_pattern_not_match(self):
19+
pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+')
20+
test_str = "asefagrragadsrgasr"
21+
result = cli.message_pattern_match(test_str, pattern)()
22+
self.assertEqual(result.is_passing(), False)
23+
24+
def test_pattern_match(self):
25+
pattern = re.compile(r'[A-Z]{3,4}-[0-9]{3,6} \| [\w\s]* \| .+')
26+
test_str = "ABC-123 | David | Commit message!"
27+
result = cli.message_pattern_match(test_str, pattern)()
28+
self.assertEqual(result.is_passing(), True)

0 commit comments

Comments
 (0)