]> Cypherpunks repositories - keks.git/commitdiff
Remove redundant prefix from test names
authorSergey Matveev <stargrave@stargrave.org>
Sat, 30 Nov 2024 17:24:32 +0000 (20:24 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sat, 30 Nov 2024 19:38:56 +0000 (22:38 +0300)
pyac/tests/test_bool.py
pyac/tests/test_int.py
pyac/tests/test_list.py
pyac/tests/test_map.py
pyac/tests/test_uuid.py

index baa7dcddedd25681558d86d7e8b526b04896ce2aa9fc1789963e9b4b72e45fde..ef19217d82b25cf7d9c235d92411c10aa96db0f3d423f50c96472615e73b8a14 100644 (file)
@@ -8,23 +8,23 @@ from tests.strategies import junk_st
 
 
 class TestBool(TestCase):
-    def test_bool_encode_true(self):
+    def test_encode_true(self):
         encoded = dumps(True)
         self.assertEqual(encoded, b"\x03")
 
-    def test_bool_encode_false(self):
+    def test_encode_false(self):
         encoded = dumps(False)
         self.assertEqual(encoded, b"\x02")
 
     @given(junk_st)
-    def test_bool_decode_true(self, junk):
+    def test_decode_true(self, junk):
         encoded = b"\x03" + junk
         decoded, tail = loads(encoded)
         self.assertIs(decoded, True)
         self.assertSequenceEqual(tail, junk)
 
     @given(junk_st)
-    def test_bool_decode_false(self, junk):
+    def test_decode_false(self, junk):
         encoded = b"\x02" + junk
         decoded, tail = loads(encoded)
         self.assertIs(decoded, False)
index df829a9851aa33cf73e3fd9fc8bb3184781e80aa12abe107cf8491ac0af7230e..6de6dbd5914c1ddc21fc2cf9fc42b0029e33de0546d3a4f47b86dd7ccc60c9a9 100644 (file)
@@ -7,7 +7,7 @@ from pyac import NotEnoughData
 
 
 class TestInt(TestCase):
-    def test_int_positive(self) -> None:
+    def test_positive(self) -> None:
         ints: list[int] = [1, 123, 1 << 64, 1 << 130]
         expected: list[bytes] = [
             b"\x0C\x81\x01",
@@ -21,7 +21,7 @@ class TestInt(TestCase):
             self.assertEqual(decoded, integer)
             self.assertSequenceEqual(tail, b"")
 
-    def test_int_negative(self) -> None:
+    def test_negative(self) -> None:
         ints: list[int] = [-1, -123, -(1 << 64), -(1 << 130)]
         expected: list[bytes] = [
             b"\x0D\x80",
@@ -35,14 +35,14 @@ class TestInt(TestCase):
             self.assertEqual(decoded, integer)
             self.assertSequenceEqual(tail, b"")
 
-    def test_int_zero(self) -> None:
+    def test_zero(self) -> None:
         encoded: bytes = dumps(0)
         self.assertSequenceEqual(encoded, b"\x0C\x80")
         decoded, tail = loads(encoded)
         self.assertEqual(decoded, 0)
         self.assertSequenceEqual(tail, b"")
 
-    def test_int_decode_not_enough_data(self) -> None:
+    def test_decode_not_enough_data(self) -> None:
         encoded: bytes = b"\x0C\x81"
         with self.assertRaises(NotEnoughData) as err:
             loads(encoded)
index b7173933cb44b613921509d2e7b2675fdf21ba5fc437c06bd79bdf4aac04c2f3..20ae090e568d1880d133944e0ffee2ffdd233de06bbe41ddf9a37816e6a213af 100644 (file)
@@ -12,25 +12,25 @@ from tests.strategies import junk_st
 
 
 class TestList(TestCase):
-    def test_list_encode_empty(self) -> None:
+    def test_encode_empty(self) -> None:
         encoded = dumps([])
         self.assertSequenceEqual(encoded, b"\x08\x00")
 
     @given(lists(any_st, max_size=4))
-    def test_list_encode_non_empty(self, test_list: List) -> None:
+    def test_encode_non_empty(self, test_list: List) -> None:
         encoded = dumps(test_list)
         self.assertSequenceEqual(
             encoded, b"\x08" + b"".join(dumps(i) for i in test_list) + b"\x00"
         )
 
-    def test_list_decode_empty(self) -> None:
+    def test_decode_empty(self) -> None:
         encoded = b"\x08\x00"
         decoded, tail = loads(encoded)
         self.assertEqual(decoded, [])
         self.assertSequenceEqual(tail, b"")
 
     @given(lists(any_st, max_size=4), junk_st)
-    def test_list_decode_non_empty(self, test_list: List, junk: bytes) -> None:
+    def test_decode_non_empty(self, test_list: List, junk: bytes) -> None:
         encoded = b"\x08" + b"".join(dumps(i) for i in test_list) + b"\x00" + junk
         decoded, tail = loads(encoded)
         self.assertEqual(decoded, test_list)
index 1a9217f64c0085145a5da24310501448169f85f1489b46faea2cf8382e835002..fd7692ad03d8a00806f689da464fd37b6fa736274052164949779c99ba9ac2aa 100644 (file)
@@ -14,7 +14,7 @@ from tests.strategies import mapkey_st
 
 class TestMap(TestCase):
     @given(dictionaries(keys=mapkey_st, values=any_st, max_size=4))
-    def test_map_encode(self, test_map):
+    def test_encode(self, test_map):
         encoded = dumps(test_map)
         expected = (
             b"\x09" +
@@ -29,7 +29,7 @@ class TestMap(TestCase):
         self.assertSequenceEqual(encoded, expected)
 
     @given(dictionaries(keys=mapkey_st, values=any_st, max_size=4), junk_st)
-    def test_map_decode(self, test_map, junk):
+    def test_decode(self, test_map, junk):
         encoded = (
             b"\x09" +
             b"".join(
@@ -46,7 +46,7 @@ class TestMap(TestCase):
         self.assertSequenceEqual(tail, junk)
 
     @given(junk_st)
-    def test_map_empty(self, junk):
+    def test_empty(self, junk):
         test_map = {}
         encoded = dumps(test_map) + junk
         expected = b"\x09\x00" + junk
@@ -63,35 +63,35 @@ class TestMap(TestCase):
         self.assertSetEqual(decoded, keys)
         self.assertSequenceEqual(tail, junk)
 
-    def test_map_throws_when_decoding_unsorted_keys(self):
+    def test_throws_when_decoding_unsorted_keys(self):
         encoded = b"\x09\xc4key2\x0c\x81\x01\xc4key1\xc6value1\x00"
         with self.assertRaises(DecodeError) as err:
             loads(encoded)
         self.assertEqual(str(err.exception), "unsorted keys")
 
-    def test_map_throws_when_encoding_non_string_key(self):
+    def test_throws_when_encoding_non_string_key(self):
         with self.assertRaises(ValueError) as err:
             dumps({1: "a"})
         self.assertEqual(str(err.exception), "map keys can contain only strings")
 
-    def test_map_throws_when_decoding_non_string_key(self):
+    def test_throws_when_decoding_non_string_key(self):
         encoded = b"\x09\x0c\x80\xc6value2\x00"
         with self.assertRaises(DecodeError) as err:
             loads(encoded)
         self.assertEqual(str(err.exception), "non-string key")
 
-    def test_map_throws_when_unexpected_eoc(self):
+    def test_throws_when_unexpected_eoc(self):
         encoded = b"\x09\xc4key1\x00\x00"
         with self.assertRaises(DecodeError) as err:
             decoded, tail = loads(encoded)
         self.assertEqual(str(err.exception), "unexpected EOC")
 
-    def test_map_throws_when_encoding_empty_str_as_key(self):
+    def test_throws_when_encoding_empty_str_as_key(self):
         with self.assertRaises(ValueError) as err:
             dumps({"": "a"})
         self.assertEqual(str(err.exception), "map keys can not be empty")
 
-    def test_map_throws_when_decoding_empty_str_as_key(self):
+    def test_throws_when_decoding_empty_str_as_key(self):
         encoded = b"\x09\xc0\x0c\x81\x01\xc4key1\xc6value1\x00"
         with self.assertRaises(DecodeError) as err:
             decoded, tail = loads(encoded)
index a519ec4276836499f0c5bc1b0395641a7254c535917ddedfa20e0e84a4dac74f..2d5a9145a57c1523ba0e422323245955a697f5b0200bf2a6cff5bfbb701197a5 100644 (file)
@@ -10,14 +10,14 @@ from tests.strategies import junk_st
 
 
 class TestUUID(TestCase):
-    def test_uuid_encode(self) -> None:
+    def test_encode(self) -> None:
         uuid_str: str = "12345678-1234-5678-1234-567812345678"
         uuid_obj: UUID = UUID(uuid_str)
         encoded: bytes = dumps(uuid_obj)
         self.assertSequenceEqual(encoded, b"\x04\x124Vx\x124Vx\x124Vx\x124Vx")
 
     @given(junk_st)
-    def test_uuid_decode(self, junk: bytes) -> None:
+    def test_decode(self, junk: bytes) -> None:
         uuid_str: str = "12345678-1234-5678-1234-567812345678"
         encoded: bytes = b"\x04\x124Vx\x124Vx\x124Vx\x124Vx"
         decoded: UUID
@@ -25,7 +25,7 @@ class TestUUID(TestCase):
         self.assertEqual(decoded, UUID(uuid_str))
         self.assertSequenceEqual(tail, junk)
 
-    def test_uuid_not_enough_data(self) -> None:
+    def test_not_enough_data(self) -> None:
         encoded: bytes = b"\x04\x124Vx\x124Vx\x124Vx\x124V"
         with self.assertRaises(NotEnoughData):
             loads(encoded)