Exemplo n.º 1
0
    def test_response(self):
        self.assertRaises(AttributeError, wikidata.response, None)
        self.assertRaises(AttributeError, wikidata.response, [])
        self.assertRaises(AttributeError, wikidata.response, '')
        self.assertRaises(AttributeError, wikidata.response, '[]')

        response = mock.Mock(content='<html></html>', search_params={"language": "all"})
        self.assertEqual(wikidata.response(response), [])
    def test_response(self):
        self.assertRaises(AttributeError, wikidata.response, None)
        self.assertRaises(AttributeError, wikidata.response, [])
        self.assertRaises(AttributeError, wikidata.response, '')
        self.assertRaises(AttributeError, wikidata.response, '[]')

        response = mock.Mock(text='<html></html>',
                             search_params={"language": "all"})
        self.assertEqual(wikidata.response(response), [])
Exemplo n.º 3
0
    def test_response(self):
        self.assertRaises(AttributeError, wikidata.response, None)
        self.assertRaises(AttributeError, wikidata.response, [])
        self.assertRaises(AttributeError, wikidata.response, '')
        self.assertRaises(AttributeError, wikidata.response, '[]')

        wikidata.supported_languages = ['en', 'es']
        response = mock.Mock(text='<html></html>', search_params={"language": "en"})
        self.assertEqual(wikidata.response(response), [])
Exemplo n.º 4
0
    def test_response(self):
        self.assertRaises(AttributeError, wikidata.response, None)
        self.assertRaises(AttributeError, wikidata.response, [])
        self.assertRaises(AttributeError, wikidata.response, '')
        self.assertRaises(AttributeError, wikidata.response, '[]')

        wikidata.supported_languages = ['en', 'es']
        wikidata.language_aliases = {}
        response = mock.Mock(content='<html></html>'.encode("utf-8"), search_params={"language": "en"})
        self.assertEqual(wikidata.response(response), [])
Exemplo n.º 5
0
    def test_response(self):
        self.assertRaises(AttributeError, wikidata.response, None)
        self.assertRaises(AttributeError, wikidata.response, [])
        self.assertRaises(AttributeError, wikidata.response, '')
        self.assertRaises(AttributeError, wikidata.response, '[]')

        wikidata.supported_languages = ['en', 'es']
        response = mock.Mock(text='<html></html>',
                             search_params={"language": "en"})
        self.assertEqual(wikidata.response(response), [])