-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.py
executable file
·31 lines (22 loc) · 1.03 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
import unittest
from mashed_potato import get_paths_from_configuration, is_being_monitored
class ConfigurationTest(unittest.TestCase):
def test_comments_ignored(self):
path_regexps = get_paths_from_configuration("# foo \n# bar")
self.assertEqual(path_regexps, [])
def test_blank_lines_ignored(self):
path_regexps = get_paths_from_configuration("# \n # ")
self.assertEqual(path_regexps, [])
def test_regexp_number(self):
path_regexps = get_paths_from_configuration("foo\nbar\nbaz")
self.assertEqual(len(path_regexps), 3)
class RegexpMatchingTest(unittest.TestCase):
def test_simple_regexp(self):
path_regexps = get_paths_from_configuration("foo")
self.assertEqual(is_being_monitored(path_regexps, "foo"), True)
def test_complex_regexp(self):
path_regexps = get_paths_from_configuration("abc/[^/]+/ghi")
self.assertEqual(is_being_monitored(path_regexps, "abc/def/ghi"), True)
if __name__ == '__main__':
unittest.main()