示例#1
0
class TestBlockContextWithParent:
    def setUp(self):
        p = BlockContext(None)
        self.c = BlockContext(p)

    def test_indent(self):
        assert self.c.indent == 2

    def test_add_str(self):
        self.c.add('foo')
        assert str(self.c) == '{\nfoo  }'
示例#2
0
class TestBlockContextWithParent:
    def setUp(self):
        p = BlockContext(None)
        self.c = BlockContext(p)

    def test_indent(self):
        assert self.c.indent == 2

    def test_add_str(self):
        self.c.add('foo')
        assert str(self.c) == '{\nfoo  }'
示例#3
0
class TestBlockContext:
    def setUp(self):
        self.c = BlockContext(None)
        self.c2 = BlockContext(self.c)

    def test_indent(self):
        assert self.c.indent == 0
        assert self.c2.indent == 2

    def test_str(self):
        assert str(self.c) == '{\n}'

    def test_add_str(self):
        self.c.add('foo')
        assert str(self.c) == '{\nfoo}'
示例#4
0
class TestBlockContext:
    def setUp(self):
        self.c = BlockContext(None)
        self.c2 = BlockContext(self.c)

    def test_indent(self):
        assert self.c.indent == 0
        assert self.c2.indent == 2

    def test_str(self):
        assert str(self.c) == '{\n}'

    def test_add_str(self):
        self.c.add('foo')
        assert str(self.c) == '{\nfoo}'