Commits

Gael Pasgrimaud committed 0512a85

fix #64#66

  • Participants
  • Parent commits a785363

Comments (0)

Files changed (5)

File buildout-py3k.cfg

 develop = .
 
 [eggs]
-recipe = zc.recipe.egg
+recipe = z3c.recipe.script
 eggs =
     WebOb>1.1.9
     pyquery

File docs/css.txt

 You can play with css classes::
 
     >>> p.addClass("toto")
-    [<p#hello.toto.hello>]
+    [<p#hello.hello.toto>]
     >>> p.toggleClass("titi toto")
     [<p#hello.titi.hello>]
     >>> p.removeClass("titi")

File pyquery/pyquery.py

         """
         for tag in self:
             values = value.split(' ')
-            classes = set((tag.get('class') or '').split())
-            classes = classes.union(values)
-            classes.difference_update([''])
+            classes = (tag.get('class') or '').split()
+            classes += [v for v in values if v not in classes]
             tag.set('class', ' '.join(classes))
         return self
 
             text = []
 
             def add_text(tag, no_tail=False):
-                if tag.text:
+                if tag.text and not isinstance(tag, lxml.etree._Comment):
                     text.append(tag.text)
                 for child in tag.getchildren():
                     add_text(child)

File pyquery/test.py

         assert len(doc('.node')) == 1, doc
 
 
+class TestComment(unittest.TestCase):
+
+    def test_comment(self):
+        doc = pq('<div><!-- foo --> bar</div>')
+        self.assertEqual(doc.text(), 'bar')
+
+
 class TestCallback(unittest.TestCase):
     html = """
         <ol>
 basepython=python3.2
 changedir={toxinidir}
 commands =
-    rm -f .installed.cfg
-    python3.2 bootstrap-py3k.py buildout:parts-directory={envdir}/parts buildout:bin-directory={envbindir}
-    {envbindir}/buildout -c buildout-py3k.cfg buildout:parts-directory={envdir}/parts buildout:bin-directory={envbindir}
     {envbindir}/nosetests
+deps =
+  nose
+  webob
 
 [testenv:py33]
 basepython=python3.3
 changedir={toxinidir}
 commands =
-    rm -f .installed.cfg
-    python3.3 bootstrap-py3k.py buildout:parts-directory={envdir}/parts buildout:bin-directory={envbindir}
-    {envbindir}/buildout -c buildout-py3k.cfg buildout:parts-directory={envdir}/parts buildout:bin-directory={envbindir}
     {envbindir}/nosetests
+deps =
+  nose
+  webob