at master 2.4 kB view raw
1diff --git a/slugify/tests.py b/slugify/tests.py 2index 9f636c4..5562e87 100644 3--- a/slugify/tests.py 4+++ b/slugify/tests.py 5@@ -3,7 +3,7 @@ from __future__ import unicode_literals 6 7 import six 8 import unittest 9-from nose.tools import eq_, raises 10+import pytest 11 12 from slugify import slugify, smart_text, SLUG_OK 13 14@@ -13,31 +13,31 @@ def test_slugify(): 15 x = '-'.join([u, u]) 16 y = ' - '.join([u, u]) 17 18- @raises(ValueError) 19 def test_incoherent_ok_and_only_ascii_raises_an_error(): 20 """Checks that only_ascii=True with non ascii "ok" chars actually raises an error.""" 21- slugify('angry smiley !', ok='è_é', only_ascii=True) 22+ with pytest.raises(ValueError): 23+ slugify('angry smiley !', ok='è_é', only_ascii=True) 24 25 def check(x, y): 26- eq_(slugify(x), y) 27+ assert slugify(x) == y 28 29 def check_only_ascii(x, y): 30- eq_(slugify(x, only_ascii=True), y) 31+ assert slugify(x, only_ascii=True) == y 32 33 def check_only_ascii_capital(x, y): 34- eq_(slugify(x, lower=False, only_ascii=True), y) 35+ assert slugify(x, lower=False, only_ascii=True) == y 36 37 def check_only_ascii_lower_nospaces(x, y): 38- eq_(slugify(x, lower=True, spaces=False, only_ascii=True), y) 39+ assert slugify(x, lower=True, spaces=False, only_ascii=True) == y 40 41 def check_ok_chars(x, y): 42- eq_(slugify(x, ok='-♰é_è'), y) 43+ assert slugify(x, ok='-♰é_è') == y 44 45 def check_empty_ok_chars(x, y): 46- eq_(slugify(x, ok=''), y) 47+ assert slugify(x, ok='') == y 48 49 def check_limited_ok_chars_only_ascii(x, y): 50- eq_(slugify(x, ok='-', only_ascii=True), y) 51+ assert slugify(x, ok='-', only_ascii=True) == y 52 53 s = [('xx x - "#$@ x', 'xx-x-x'), 54 ('Bän...g (bang)', 'bäng-bang'), 55@@ -112,11 +112,11 @@ def test_slugify(): 56 57 #Test custom space replacement 58 x, y = ('-☀- pretty waves under the sunset 😎', '--~pretty~waves~under~the~sunset') 59- eq_(slugify(x, space_replacement='~'), y) 60+ assert slugify(x, space_replacement='~') == y 61 62 #Test default auto space replacement 63 x, y = ('-☀- pretty waves under the sunset 😎', 'pretty~waves~under~the~sunset') 64- eq_(slugify(x, ok='~'), y) 65+ assert slugify(x, ok='~') == y 66 67 68 class SmartTextTestCase(unittest.TestCase): 69