Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 6
0
 def setUp(self):
     self.parser = GeoMicroformat()
Exemplo n.º 7
0
 def setUp(self):
     self.parser = GeoMicroformat(shorthand=False)
Exemplo n.º 8
0
 def setUp(self):
     self.parser = GeoMicroformat()