diff options
| author | Euan Goddard <euangoddard@2degreesnetwork.com> | 2015-05-06 09:11:09 +0100 |
|---|---|---|
| committer | Euan Goddard <euangoddard@2degreesnetwork.com> | 2015-05-06 09:11:09 +0100 |
| commit | f60687c611f6ef8262870ef5f50bcd54242b904b (patch) | |
| tree | e67d46fe40199d61e5b0c4352c25a0a36fbe2af8 /test.py | |
| parent | 367106de80cc7db78f14904de851d59d68aa3d0d (diff) | |
| download | python-slugify-f60687c611f6ef8262870ef5f50bcd54242b904b.tar.gz | |
Added support to strip stopwords
Closes #14
Diffstat (limited to 'test.py')
| -rw-r--r-- | test.py | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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() |
