add 'noop()' and 'identity()' functions

This commit is contained in:
Mike Fährmann
2021-05-04 18:00:38 +02:00
parent 755164b36a
commit c5ca7905ce
4 changed files with 20 additions and 4 deletions

View File

@@ -484,6 +484,13 @@ class TestOther(unittest.TestCase):
with self.assertRaises(ValueError):
func(3)
def test_identity(self):
for value in (123, "foo", [1, 2, 3], (1, 2, 3), {1: 2}, None):
self.assertIs(util.identity(value), value)
def test_noop(self):
self.assertEqual(util.noop(), None)
def test_generate_token(self):
tokens = set()
for _ in range(100):