Add unit tests on the sphinxext indent function
Change-Id: I7c761710e88d144fef4736295e8d9dd85bf72396
This commit is contained in:
parent
b7da7a92ad
commit
0d01756c1d
@ -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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user