summaryrefslogtreecommitdiff
path: root/test.py
diff options
context:
space:
mode:
authorEuan Goddard <euangoddard@2degreesnetwork.com>2015-05-06 09:11:09 +0100
committerEuan Goddard <euangoddard@2degreesnetwork.com>2015-05-06 09:11:09 +0100
commitf60687c611f6ef8262870ef5f50bcd54242b904b (patch)
treee67d46fe40199d61e5b0c4352c25a0a36fbe2af8 /test.py
parent367106de80cc7db78f14904de851d59d68aa3d0d (diff)
downloadpython-slugify-f60687c611f6ef8262870ef5f50bcd54242b904b.tar.gz
Added support to strip stopwords
Closes #14
Diffstat (limited to 'test.py')
-rw-r--r--test.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/test.py b/test.py
index 765a668..ee1a04c 100644
--- a/test.py
+++ b/test.py
@@ -107,6 +107,25 @@ class TestSlugification(unittest.TestCase):
r = slugify(txt, max_length=12, word_boundary=True, save_order=True)
self.assertEqual(r, "one-two")
+ def test_stopword_removal(self):
+ txt = 'this has a stopword'
+ r = slugify(txt, stopwords=['stopword'])
+ self.assertEqual(r, 'this-has-a')
+
+ def test_multiple_stopword_occurances(self):
+ txt = 'the quick brown fox jumps over the lazy dog'
+ r = slugify(txt, stopwords=['the'])
+ self.assertEqual(r, 'quick-brown-fox-jumps-over-lazy-dog')
+
+ def test_differently_cased_stopword_match(self):
+ txt = 'Foo A FOO B foo C'
+ r = slugify(txt, stopwords=['foo'])
+ self.assertEqual(r, 'a-b-c')
+
+ txt = 'Foo A FOO B foo C'
+ r = slugify(txt, stopwords=['FOO'])
+ self.assertEqual(r, 'a-b-c')
+
if __name__ == '__main__':
unittest.main()