Esempio n. 1
0
    def test_append_multi(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')
        y = XQuery('<R><a>1<c><d>6</d></c></a><a>2<c><d>6</d></c></a><b>3</b></R>')
        z = XQuery('<c><d>6</d></c>')
        x.find('a').append(z)

        self.assertEquals(y, x)
Esempio n. 2
0
    def test_find(self):
        x = XQuery('''<R><a>1</a><b>2</b></R>''')

        self.assertEquals(XQuery('<a>1</a>'),
                          x.find('a'))
Esempio n. 3
0
    def test_text(self):
        x = XQuery('<R><a>1</a><a><c>4</c></a><b>3</b></R>')

        self.assertEquals('4', x.find('c').text())
Esempio n. 4
0
    def test_chain(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')
        x.find('a').append(XQuery('<c/>')).find('c').text("4")

        self.assertEquals(XQuery('<R><a>1<c>4</c></a><a>2<c>4</c></a><b>3</b></R>'),
                          x)
Esempio n. 5
0
    def test_empty_append(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')
        x.find('c').append(XQuery('<d/>'))

        self.assertEquals(XQuery('<R><a>1</a><a>2</a><b>3</b></R>'),
                          x)
Esempio n. 6
0
    def test_find_empty(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')

        self.assertEquals([], x.find('c'))
Esempio n. 7
0
    def test_append(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')
        y = XQuery('<R><a>1<c/></a><a>2<c/></a><b>3</b></R>')
        x.find('a').append(XQuery('<c/>'))

        self.assertEquals(y, x)
Esempio n. 8
0
    def test_find(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')
        y = x.find('R').find('a').text()

        self.assertEquals(['1','2'], y)
Esempio n. 9
0
    def test_find_multi(self):
        x = XQuery('<R><a><c>4</c></a><a>2</a><b>3</b></R>')
        y = x.find('a').find('c').text()

        self.assertEquals('4', y)
Esempio n. 10
0
    def test_modfity_text_of_node_that_is_not_exists(self):
        x = XQuery('<a>1</a>')
        x.find('b').text('2')

        self.assertEquals(XQuery('<a>1</a>'),
                          x)
Esempio n. 11
0
    def test_empty_text(self):
        x = XQuery('<R><a>1</a><a><c>4</c></a><b>3</b></R>')

        self.assertEquals([], x.find('d').text())
Esempio n. 12
0
    def test_append_multi(self):
        x = XQuery('<R><a/><c><a/></c></R>')
        x.find('a').append(XQuery('<b/>'))

        self.assertEquals(XQuery('<R><a><b/></a><c><a><b/></a></c></R>'),
                          x)
Esempio n. 13
0
    def test_text_multi(self):
        x = XQuery('<R><a>1</a><a>2</a><b>3</b></R>')

        self.assertEquals(['1', '2'],x.find('a').text())
Esempio n. 14
0
    def test_find_not_exists(self):
        x = XQuery('<R/>')

        self.assertEquals([], x.find('a'))