5 from gtkdoc
import check
8 class TestCheck(unittest
.TestCase
):
10 def test_grep_finds_token_in_one_line(self
):
11 result
= check
.grep(r
'^(foo)', ['foo'], 'foo')
12 self
.assertEqual('foo', result
)
14 def test_grep_does_not_find_token(self
):
15 with self
.assertRaises(check
.FileFormatError
) as ctx
:
16 check
.grep(r
'^(foo)', ['bar'], 'foo')
17 self
.assertEqual(str(ctx
.exception
), 'foo')
19 def test_get_variable_prefers_env(self
):
20 result
= check
.get_variable({'foo': 'bar'}, ['foo=baz'], 'foo')
21 self
.assertEqual('bar', result
)
23 def test_get_variable_finds_in_file(self
):
24 result
= check
.get_variable({}, ['foo=bar'], 'foo')
25 self
.assertEqual('bar', result
)
27 def test_get_variable_finds_in_file_with_whitespce(self
):
28 result
= check
.get_variable({}, ['foo = bar'], 'foo')
29 self
.assertEqual('bar', result
)
32 if __name__
== '__main__':