예제 #1
0
 def test_getLatestEvents(self):
     """
     Testing request method for latest events.
     """
     client = Client()
     # xml
     data = client.getLatestEvents(5, format='xml')
     self.assertTrue(isinstance(data, basestring))
     self.assertTrue(data.startswith('<?xml'))
     # list
     data = client.getLatestEvents(5, format='list')
     self.assertTrue(isinstance(data, list))
     self.assertEquals(len(data), 5)
     # catalog
     data = client.getLatestEvents(5, format='catalog')
     self.assertTrue(isinstance(data, Catalog))
     # no given number of events should default to 10
     data = client.getLatestEvents(format='list')
     self.assertEquals(len(data), 10)
     # invalid number of events should default to 10
     data = client.getLatestEvents(num='blah', format='list')
     self.assertEquals(len(data), 10)
예제 #2
0
 def test_getLatestEvents(self):
     """
     Testing request method for latest events.
     """
     client = Client()
     # xml
     data = client.getLatestEvents(5, format='xml')
     self.assertTrue(isinstance(data, basestring))
     self.assertTrue(data.startswith('<?xml'))
     # list
     data = client.getLatestEvents(5, format='list')
     self.assertTrue(isinstance(data, list))
     self.assertEquals(len(data), 5)
     # catalog
     data = client.getLatestEvents(5, format='catalog')
     self.assertTrue(isinstance(data, Catalog))
     # no given number of events should default to 10
     data = client.getLatestEvents(format='list')
     self.assertEquals(len(data), 10)
     # invalid number of events should default to 10
     data = client.getLatestEvents(num='blah', format='list')
     self.assertEquals(len(data), 10)
예제 #3
0
파일: test_client.py 프로젝트: avuan/obspy
    def test_getLatestEvents(self):
        """
        Testing request method for latest events.

        XXX: Currently we can not rely on the length of the returned list due
            to a bug in Web Service implementation.
        """
        client = Client()
        # xml
        data = client.getLatestEvents(5, format='xml')
        self.assertTrue(isinstance(data, bytes))
        self.assertTrue(data.startswith(b'<?xml'))
        # list
        data = client.getLatestEvents(5, format='list')
        self.assertTrue(isinstance(data, list))
        # catalog
        data = client.getLatestEvents(5, format='catalog')
        self.assertTrue(isinstance(data, Catalog))
        # no given number of events should default to 10
        data = client.getLatestEvents(format='list')
        self.assertTrue(isinstance(data, list))
        # invalid number of events should default to 10
        data = client.getLatestEvents(num='blah', format='list')
        self.assertTrue(isinstance(data, list))
예제 #4
0
    def test_getLatestEvents(self):
        """
        Testing request method for latest events.

        XXX: Currently we can not rely on the length of the returned list due
            to a bug in Web Service implementation.
        """
        client = Client()
        # xml
        data = client.getLatestEvents(5, format='xml')
        self.assertTrue(isinstance(data, bytes))
        self.assertTrue(data.startswith(b'<?xml'))
        # list
        data = client.getLatestEvents(5, format='list')
        self.assertTrue(isinstance(data, list))
        # catalog
        data = client.getLatestEvents(5, format='catalog')
        self.assertTrue(isinstance(data, Catalog))
        # no given number of events should default to 10
        data = client.getLatestEvents(format='list')
        self.assertTrue(isinstance(data, list))
        # invalid number of events should default to 10
        data = client.getLatestEvents(num='blah', format='list')
        self.assertTrue(isinstance(data, list))