コード例 #1
0
ファイル: test_context.py プロジェクト: moyaproject/moya
    def test_stack(self):
        c = Context()

        c.push_stack("content", "foo")
        self.assertEqual(c[".content"], "foo")
        c.push_stack("content", "bar")
        self.assertEqual(c[".content"], "bar")
        value = c.pop_stack("content")
        self.assertEqual(value, "bar")
        self.assertEqual(c[".content"], "foo")
        value = c.pop_stack("content")
        self.assertEqual(value, "foo")
        self.assert_(c[".content"] is None)
コード例 #2
0
ファイル: test_context.py プロジェクト: ui-frontend/moya
    def test_stack(self):
        c = Context()

        c.push_stack('content', 'foo')
        self.assertEqual(c['.content'], 'foo')
        c.push_stack('content', 'bar')
        self.assertEqual(c['.content'], 'bar')
        value = c.pop_stack('content')
        self.assertEqual(value, 'bar')
        self.assertEqual(c['.content'], 'foo')
        value = c.pop_stack('content')
        self.assertEqual(value, 'foo')
        self.assert_(c['.content'] is None)
コード例 #3
0
ファイル: test_context.py プロジェクト: chrmorais/moya
    def test_stack(self):
        c = Context()

        c.push_stack('content', 'foo')
        self.assertEqual(c['.content'], 'foo')
        c.push_stack('content', 'bar')
        self.assertEqual(c['.content'], 'bar')
        value = c.pop_stack('content')
        self.assertEqual(value, 'bar')
        self.assertEqual(c['.content'], 'foo')
        value = c.pop_stack('content')
        self.assertEqual(value, 'foo')
        self.assert_(c['.content'] is None)