Beispiel #1
0
class GeoMicroformatFound(object):
    def setUp(self):
        self.parser = GeoMicroformat()
    
    def test_one_str(self):
        locations = self.parser.find_all(self.MARKUP)
        self.assertTrue(len(locations) == 1)
        self._location_test(locations[0])

    def test_multi_str(self):
        locations = self.parser.find_all(self.MARKUP * 3)
        self.assertTrue(len(locations) == 3)
        for i in range(3):
            self._location_test(locations[i])

    def test_one_soup(self):
        if BeautifulSoup:
            locations = self.parser.find_all(BeautifulSoup(self.MARKUP))
            self.assertTrue(len(locations) == 1)
            self._location_test(locations[0])

    def test_multi_soup(self):
        if BeautifulSoup:
            locations = self.parser.find_all(BeautifulSoup(self.MARKUP * 3))
            self.assertTrue(len(locations) == 3)
            for i in range(3):
                self._location_test(locations[i])

    def _location_test(self, location):
        self.assertTrue(location.name == self.NAME)
        self.assertTrue(location.point == self.POINT)
Beispiel #2
0
class GeoMicroformatFound(object):
    def setUp(self):
        self.parser = GeoMicroformat()
    
    def test_one_str(self):
        locations = self.parser.find_all(self.MARKUP)
        self.failUnless(len(locations) == 1)
        self._location_test(locations[0])

    def test_multi_str(self):
        locations = self.parser.find_all(self.MARKUP * 3)
        self.failUnless(len(locations) == 3)
        for i in range(3):
            self._location_test(locations[i])

    def test_one_soup(self):
        from BeautifulSoup import BeautifulSoup
        locations = self.parser.find_all(BeautifulSoup(self.MARKUP))
        self.failUnless(len(locations) == 1)
        self._location_test(locations[0])

    def test_multi_soup(self):
        from BeautifulSoup import BeautifulSoup
        locations = self.parser.find_all(BeautifulSoup(self.MARKUP * 3))
        self.failUnless(len(locations) == 3)
        for i in range(3):
            self._location_test(locations[i])

    def _location_test(self, location):
        self.failUnless(location.name == self.NAME)
        self.failUnless(location.point == self.POINT)
Beispiel #3
0
class GeoMicroformatNotFound(object):
    def setUp(self):
        self.parser = GeoMicroformat()
    
    def test_none_str(self):
        locations = self.parser.find_all(self.MARKUP)
        self.failUnless(len(locations) == 0)
    
    def test_none_soup(self):
        from BeautifulSoup import BeautifulSoup
        locations = self.parser.find_all(BeautifulSoup(self.MARKUP))
        self.failUnless(len(locations) == 0)
Beispiel #4
0
class GeoMicroformatNotFound(object):
    def setUp(self):
        self.parser = GeoMicroformat()
    
    def test_none_str(self):
        locations = self.parser.find_all(self.MARKUP)
        self.assertTrue(len(locations) == 0)
    
    def test_none_soup(self):
        if BeautifulSoup:
            locations = self.parser.find_all(BeautifulSoup(self.MARKUP))
            self.assertTrue(len(locations) == 0)
Beispiel #5
0
class GeoMicroformatNotFound(object):
    def setUp(self):
        self.parser = GeoMicroformat()

    def test_none_str(self):
        locations = self.parser.find_all(self.MARKUP)
        self.failUnless(len(locations) == 0)

    def test_none_soup(self):
        from BeautifulSoup import BeautifulSoup
        locations = self.parser.find_all(BeautifulSoup(self.MARKUP))
        self.failUnless(len(locations) == 0)
Beispiel #6
0
 def setUp(self):
     self.parser = GeoMicroformat()
Beispiel #7
0
 def setUp(self):
     self.parser = GeoMicroformat(shorthand=False)
Beispiel #8
0
 def setUp(self):
     self.parser = GeoMicroformat()