summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-08-08 15:27:26 +0000
committerGerrit Code Review <review@openstack.org>2019-08-08 15:27:26 +0000
commit792a2778be7976e1946233af29feb8a754253e28 (patch)
tree3fd997d753b80272ee185a5f8791a1b43c560fa0
parent4d40252748bd31584f1cbb72d4641dec62cf1303 (diff)
parent0d01756c1db9a6c19d263edadeda775adf5291af (diff)
downloadoslo-policy-792a2778be7976e1946233af29feb8a754253e28.tar.gz
Merge "Add unit tests on the sphinxext indent function"
-rw-r--r--oslo_policy/tests/test_sphinxext.py30
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):