diff options
| author | edunham <edunham@mozilla.com> | 2015-09-20 18:31:01 -0700 |
|---|---|---|
| committer | edunham <edunham@mozilla.com> | 2015-09-20 18:31:01 -0700 |
| commit | 115c1eb56421a36159768e1fcd9a00386988b209 (patch) | |
| tree | 0bb71aec04d508091de9b8f85adc1e2775f6dd6b | |
| parent | 632ea7d6d54302443d8011727ed5ef7174d50640 (diff) | |
| download | python-slugify-115c1eb56421a36159768e1fcd9a00386988b209.tar.gz | |
Add test cases containing numbers
| -rw-r--r-- | test.py | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -136,6 +136,31 @@ class TestSlugification(unittest.TestCase): r = slugify(txt) self.assertEqual(r, 'foo-bar') + def test_starts_with_number(self): + txt = '10 amazing secrets' + r = slugify(txt) + self.assertEqual(r, '10-amazing-secrets') + + def test_contains_numbers(self): + txt = 'buildings with 1000 windows' + r = slugify(txt) + self.assertEqual(r, 'buildings-with-1000-windows') + + def test_ends_with_number(self): + txt = 'recipe number 3' + r = slugify(txt) + self.assertEqual(r, 'recipe-number-3') + + def test_numbers_only(self): + txt = '404' + r = slugify(txt) + self.assertEqual(r, '404') + + def test_numbers_and_symbols(self): + txt = '1,000 reasons you are #1' + r = slugify(txt) + self.assertEqual(r, '1000-reasons-you-are-1') + if __name__ == '__main__': unittest.main() |
