diff options
author | Hervé Beraud <hberaud@redhat.com> | 2019-07-17 12:50:51 +0200 |
---|---|---|
committer | Hervé Beraud <hberaud@redhat.com> | 2019-07-22 11:46:09 +0200 |
commit | 0d01756c1db9a6c19d263edadeda775adf5291af (patch) | |
tree | 8f58e4ce47c7447b6d81a2fd83be07f0c968412c /oslo_policy | |
parent | b7da7a92ad558947d6a133800f6049578e450b6a (diff) | |
download | oslo-policy-0d01756c1db9a6c19d263edadeda775adf5291af.tar.gz |
Add unit tests on the sphinxext indent function
Change-Id: I7c761710e88d144fef4736295e8d9dd85bf72396
Diffstat (limited to 'oslo_policy')
-rw-r--r-- | oslo_policy/tests/test_sphinxext.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/oslo_policy/tests/test_sphinxext.py b/oslo_policy/tests/test_sphinxext.py index 591b72e..9449395 100644 --- a/oslo_policy/tests/test_sphinxext.py +++ b/oslo_policy/tests/test_sphinxext.py @@ -20,6 +20,36 @@ from oslo_policy import policy from oslo_policy import sphinxext +class IndentTest(base.BaseTestCase): + + def test_indent(self): + result = sphinxext._indent("foo\nbar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("") + self.assertEqual("", result) + + result = sphinxext._indent("\n") + self.assertEqual("\n", result) + + result = sphinxext._indent("test\ntesting\n\nafter blank") + self.assertEqual(" test\n testing\n\n after blank", result) + + result = sphinxext._indent("\tfoo\nbar") + self.assertEqual(" \tfoo\n bar", result) + + result = sphinxext._indent(" foo\nbar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("foo\n bar") + self.assertEqual(" foo\n bar", result) + + result = sphinxext._indent("foo\n\n bar") + self.assertEqual(" foo\n\n bar", result) + + self.assertRaises(AttributeError, sphinxext._indent, None) + + class FormatPolicyTest(base.BaseTestCase): def test_minimal(self): |