浏览代码

add more tests

Oz N Tiram 9 年之前
父节点
当前提交
b1588b72b0
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      tests/test_all.py

+ 9 - 2
tests/test_all.py

@@ -111,12 +111,19 @@ def test_tags():
     assert len(t) == 4
     assert t[0].name == u'buf'
 
-    new_tag = Tag('bug')
+    new_tag = Tag('buggg')
     new_tag.posts = [100,100]
     with pytest.raises(ValueError):
         new_tag.posts = "This should not work"
     with pytest.raises(ValueError):
         new_tag.posts = 1  # This should not either
 
-#os.unlink(DB._db._storage._handle.name)
+def test_slug():
+
+    t = Tag('foo:bar')
+    assert t.slug == "foo-bar"
+    t = Tag('foo:;bar,.,baz')
+    assert t.slug == "foo-bar-baz"
+
+os.unlink(DB._db._storage._handle.name)