Skip to content

Commit

Permalink
formatting, py3
Browse files Browse the repository at this point in the history
  • Loading branch information
pudo committed Jan 9, 2025
1 parent 3f7f012 commit 79d5c28
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions tests/test_normality.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import unittest
from datetime import datetime
from datetime import datetime, UTC

from normality import normalize, latinize_text, ascii_text
from normality import (
Expand All @@ -22,22 +22,22 @@ def test_empty(self):
self.assertEqual(None, normalize(" "))

def test_petro(self):
text = u"Порошенко Петро Олексійович"
text = "Порошенко Петро Олексійович"
self.assertEqual("porosenko-petro-oleksijovic", slugify(text))
self.assertEqual("Porosenko Petro Oleksijovic", ascii_text(text))
self.assertEqual(u"Porošenko Petro Oleksíjovič", latinize_text(text))
self.assertEqual(u"порошенко петро олексіиович", normalize(text))
self.assertEqual("Porošenko Petro Oleksíjovič", latinize_text(text))
self.assertEqual("порошенко петро олексіиович", normalize(text))

def test_ahmad(self):
text = u"əhməd"
text = "əhməd"
self.assertEqual("ahmad", ascii_text(text))

def test_azeri(self):
text = u"FUAD ALIYEV ƏHMƏD OĞLU"
text = "FUAD ALIYEV ƏHMƏD OĞLU"
self.assertEqual("FUAD ALIYEV AHMAD OGLU", ascii_text(text))

def test_slugify(self):
text = u"BABY! camel-is good"
text = "BABY! camel-is good"
self.assertEqual("baby-camel-is-good", slugify(text, sep="-"))
self.assertEqual("tests", slugify("testʼs", sep="-"))
self.assertEqual("test-s", slugify("test_s", sep="-"))
Expand All @@ -47,11 +47,11 @@ def test_slugify(self):
self.assertEqual(None, slugify(None, sep="-"))

def test_georgian(self):
text = u"ავლაბრის ფონდი"
text = "ავლაბრის ფონდი"
self.assertEqual("avlabris pondi", ascii_text(text))

def test_german(self):
text = u"Häschen Spaß"
text = "Häschen Spaß"
self.assertEqual("Haschen Spass", ascii_text(text))
self.assertEqual("haschen-spass", slugify(text, sep="-"))

Expand All @@ -61,18 +61,18 @@ def test_stringify(self):
self.assertEqual("0.5", stringify(0.5))

def test_stringify_datetime(self):
dt = datetime.utcnow()
dt = datetime.now(UTC)
text = stringify(dt)
self.assertTrue(text.startswith("%s-" % dt.year), text)

def test_guess_encoding(self):
text = u"Порошенко Петро Олексійович"
text = "Порошенко Петро Олексійович"
encoded = text.encode("iso-8859-5")
out = guess_encoding(encoded)
self.assertEqual("iso8859-5", out)

def test_predict_encoding(self):
text = u"Порошенко Петро Олексійович"
text = "Порошенко Петро Олексійович"
encoded = text.encode("iso-8859-5")
out = predict_encoding(encoded)
self.assertEqual("iso8859-5", out)
Expand All @@ -88,13 +88,13 @@ def test_predict_file_encoding(self):
self.assertEqual("utf-16", out)

def test_petro_iso_encoded(self):
text = u"Порошенко Петро Олексійович"
text = "Порошенко Петро Олексійович"
encoded = text.encode("iso8859-5")
out = stringify(encoded)
self.assertEqual(text, out)

def test_petro_utf16_encoded(self):
text = u"Порошенко Петро Олексійович"
text = "Порошенко Петро Олексійович"
encoded = text.encode("utf-16")
out = stringify(encoded)
self.assertEqual(text, out)

0 comments on commit 79d5c28

Please sign in to comment.