Starting a test suite
This commit is contained in:
parent
3691f7f3e6
commit
58d0ea0575
2 changed files with 54 additions and 1 deletions
34
test_secretary.py
Normal file
34
test_secretary.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
from xml.dom.minidom import getDOMImplementation
|
||||
from unittest import TestCase
|
||||
from secretary import UndefinedSilently, pad_string, Render
|
||||
|
||||
def test_undefined_silently():
|
||||
undefined = UndefinedSilently()
|
||||
|
||||
assert isinstance(undefined(), UndefinedSilently)
|
||||
assert isinstance(undefined.attribute, UndefinedSilently)
|
||||
assert unicode(undefined) == u''
|
||||
assert str(undefined) == ''
|
||||
|
||||
def test_pad_string():
|
||||
assert pad_string('TEST') == '0TEST'
|
||||
assert pad_string('TEST', 4) == 'TEST'
|
||||
assert pad_string(1) == '00001'
|
||||
|
||||
class RenderTestCase(TestCase):
|
||||
def setUp(self):
|
||||
root = os.path.dirname(__file__)
|
||||
impl = getDOMImplementation()
|
||||
template = os.path.join(root, 'simple_template.odt')
|
||||
|
||||
self.document = impl.createDocument(None, "some_tag", None)
|
||||
self.render = Render(template)
|
||||
|
||||
def test_create_test_node(self):
|
||||
assert self.render.create_text_node(self.document, 'text').toxml() == 'text'
|
||||
|
||||
def test_create_text_span_node(self):
|
||||
assert self.render.create_text_span_node(self.document, 'text').toxml() == '<text:span>text</text:span>'
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue