From: Sergey Matveev Date: Sat, 30 Nov 2024 17:24:32 +0000 (+0300) Subject: Remove redundant prefix from test names X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=7b64f285bde0fc27166b4fb81b8884e8e52114cec9c286696ab055a859fe5a57;p=keks.git Remove redundant prefix from test names --- diff --git a/pyac/tests/test_bool.py b/pyac/tests/test_bool.py index baa7dcd..ef19217 100644 --- a/pyac/tests/test_bool.py +++ b/pyac/tests/test_bool.py @@ -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) diff --git a/pyac/tests/test_int.py b/pyac/tests/test_int.py index df829a9..6de6dbd 100644 --- a/pyac/tests/test_int.py +++ b/pyac/tests/test_int.py @@ -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) diff --git a/pyac/tests/test_list.py b/pyac/tests/test_list.py index b717393..20ae090 100644 --- a/pyac/tests/test_list.py +++ b/pyac/tests/test_list.py @@ -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) diff --git a/pyac/tests/test_map.py b/pyac/tests/test_map.py index 1a9217f..fd7692a 100644 --- a/pyac/tests/test_map.py +++ b/pyac/tests/test_map.py @@ -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) diff --git a/pyac/tests/test_uuid.py b/pyac/tests/test_uuid.py index a519ec4..2d5a914 100644 --- a/pyac/tests/test_uuid.py +++ b/pyac/tests/test_uuid.py @@ -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)