Commit 85321375 authored by Bengfort's avatar Bengfort
Browse files

port tests to unittest

parent 2d776315
import pytest
import unittest
from castellum_pseudonyms import clean, generate
@pytest.mark.unittest
def test_clean_generated():
clean(generate())
class TestPseudonyms(unittest.TestCase):
def test_clean_generated(self):
clean(generate())
def test_clean_invalid_checksum(self):
with self.assertRaises(ValueError) as cm:
clean('foo')
self.assertNotIn('invalid characters', str(cm.exception))
@pytest.mark.unittest
def test_clean_invalid_checksum():
with pytest.raises(ValueError) as excinfo:
clean('foo')
assert 'invalid characters' not in str(excinfo.value)
def test_clean_invalid_chars(self):
with self.assertRaises(ValueError) as cm:
clean('ABC!')
self.assertIn('invalid characters', str(cm.exception))
def test_check_denormalized(self):
self.assertEqual(clean('vg83END03T'), 'VG83END03T')
self.assertEqual(clean('VG83ENDO3T'), 'VG83END03T')
@pytest.mark.unittest
def test_clean_invalid_chars():
with pytest.raises(ValueError) as excinfo:
clean('ABC!')
assert 'invalid characters' in str(excinfo.value)
@pytest.mark.unittest
def test_check_denormalized():
assert clean('vg83END03T') == 'VG83END03T'
assert clean('VG83ENDO3T') == 'VG83END03T'
if __name__ == '__main__':
unittest.main()
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment