Commits

Vlad Riscutia committed 4ef1fda Draft

Update tests so they run with Python 2.6

Comments (0)

Files changed (7)

tinkertest/test_categories.py

     blog_categories = app.builder.env.filing["categories"]
 
     # check collected categories
-    utils.test.assertEquals({"category #1", "category #2"}, set(blog_categories))
+    utils.test.assertEquals(set(["category #1", "category #2"]), set(blog_categories))
 
     # check categories
-    for result in [({"2010/10/01/post1", "2010/10/01/post12"}, "category #1"),
-                   ({"2010/10/01/post2", "2010/10/01/post12"}, "category #2")]:
+    for result in [(set(["2010/10/01/post1", "2010/10/01/post12"]), "category #1"),
+                   (set(["2010/10/01/post2", "2010/10/01/post12"]), "category #2")]:
         utils.test.assertEquals(result[0], set(blog_categories[result[1]]))
 
     # check post metadata

tinkertest/test_cmdline.py

 
         self.assertEqual(
             set(os.listdir(utils.TEST_ROOT)),
-            {
+            set([
                 "_static",
                 "drafts",
                 "conf.py",
                 "index.html",
                 tinkerer.master_doc + ".rst"
-            })
+            ]))
 
 
     # test post from title

tinkertest/test_draft.py

 
         # page and posts should be in master doc (precondition)
         lines = master.read_master()
-        self.assertIn("   %s\n" % new_post.docname, lines)
-        self.assertIn("   %s\n" % new_page.docname, lines)
+        self.assertTrue("   %s\n" % new_post.docname in lines)
+        self.assertTrue("   %s\n" % new_page.docname in lines)
 
         new_draft = draft.move(os.path.join(
                             utils.TEST_ROOT, "pages", "a_page.rst"))
 
         # page should no longer be in TOC
         lines = master.read_master()
-        self.assertIn("   %s\n" % new_post.docname, lines)
-        self.assertNotIn("   %s\n" % new_page.docname, lines)
+        self.assertTrue("   %s\n" % new_post.docname in lines)
+        self.assertFalse("   %s\n" % new_page.docname in lines)
 
         new_draft = draft.move(os.path.join(
                             utils.TEST_ROOT, "2010", "10", "01", "a_post.rst"))
 
         # post should no longer be in TOC either
         lines = master.read_master()
-        self.assertNotIn("   %s\n" % new_post.docname, lines)
-        self.assertNotIn("   %s\n" % new_page.docname, lines)
+        self.assertFalse("   %s\n" % new_post.docname in lines)
+        self.assertFalse("   %s\n" % new_page.docname in lines)
 
 
     # test content

tinkertest/test_metadata.py

     utils.test.assertEquals(set(pages), set(env.blog_pages))
 
     # body should contain the whole 100 word string
-    utils.test.assertIn(" ".join("a" * 100),
+    utils.test.assertTrue(" ".join("a" * 100) in
             env.blog_metadata[env.blog_posts[0]].body)
 
 

tinkertest/test_patch.py

             with open(os.path.join(paths.html, *test[0]), "r") as f:
                 content = f.read()
                 for data in test[1]:
-                    self.assertIn(data, content)
+                    self.assertTrue(data in content)
 
 
 

tinkertest/test_rss.py

             self.assertEquals(item["link"], data["link"])
             self.assertEquals(item["link"], data["guid"])
             self.assertEquals(item["title"], data["title"])
-            self.assertIn(item["description"], data["description"])
-            self.assertIn(item["category"], data["category"])
+            self.assertTrue(item["description"] in data["description"])
+            self.assertTrue(item["category"] in data["category"])
             self.assertEquals(item["pubDate"], data["pubDate"])
 
 

tinkertest/test_tags.py

     blog_tags = app.builder.env.filing["tags"]
 
     # check collected tags
-    utils.test.assertEquals({"tag #1", "tag #2"}, set(blog_tags))
+    utils.test.assertEquals(set(["tag #1", "tag #2"]), set(blog_tags))
 
     # check tagged posts
-    for result in [({"2010/10/01/post1", "2010/10/01/post12"}, "tag #1"),
-                   ({"2010/10/01/post2", "2010/10/01/post12"}, "tag #2")]:
+    for result in [(set(["2010/10/01/post1", "2010/10/01/post12"]), "tag #1"),
+                   (set(["2010/10/01/post2", "2010/10/01/post12"]), "tag #2")]:
         utils.test.assertEquals(result[0], set(blog_tags[result[1]]))
 
     # check post metadata