Skip to content

Commit

Permalink
Add typing
Browse files Browse the repository at this point in the history
  • Loading branch information
pawlizio committed Nov 30, 2023
1 parent 2d2322a commit b522dc6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/string_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ class TestString(unittest.TestCase):

# pylint: disable=too-many-public-methods,invalid-name

def test_encoding(self):
def test_encoding(self) -> None:
"""Test simple encoding."""
self.assertEqual(string_to_bytes("fnord", 10), b"fnord" + bytes(5))

def test_encoding_without_padding(self):
def test_encoding_without_padding(self) -> None:
"""Test encoding with exact match of size."""
self.assertEqual(string_to_bytes("fnord", 5), b"fnord")

def test_encoding_failure(self):
def test_encoding_failure(self) -> None:
"""Test error while encoding."""
with self.assertRaises(PyVLXException):
string_to_bytes("fnord", 4)

def test_decoding(self):
def test_decoding(self) -> None:
"""Test decoding of string."""
self.assertEqual(bytes_to_string(b"fnord" + bytes(5)), "fnord")

def test_decoding_without_padding(self):
def test_decoding_without_padding(self) -> None:
"""Test decoding of string without padding."""
self.assertEqual(bytes_to_string(b"fnord"), "fnord")

def test_encode_utf8(self):
def test_encode_utf8(self) -> None:
"""Test encoding a string with special characters."""
self.assertEqual(
string_to_bytes("Fenster Büro", 16), b"Fenster B\xc3\xbcro\x00\x00\x00"
)

def test_decode_utf8(self):
def test_decode_utf8(self) -> None:
"""Test decoding a string with special characters."""
self.assertEqual(
bytes_to_string(b"Fenster B\xc3\xbcro\x00\x00\x00"), "Fenster Büro"
Expand Down

0 comments on commit b522dc6

Please sign in to comment.