Skip to content

Commit

Permalink
Add tests for previous commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaugustin committed Jul 21, 2024
1 parent 61b69db commit 96d3adf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/legacy/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -1472,10 +1472,24 @@ def test_broadcast_text(self):
broadcast([self.protocol], "café")
self.assertOneFrameSent(True, OP_TEXT, "café".encode())

@unittest.skipIf(
sys.version_info[:2] < (3, 11), "raise_exceptions requires Python 3.11+"
)
def test_broadcast_text_reports_no_errors(self):
broadcast([self.protocol], "café", raise_exceptions=True)
self.assertOneFrameSent(True, OP_TEXT, "café".encode())

def test_broadcast_binary(self):
broadcast([self.protocol], b"tea")
self.assertOneFrameSent(True, OP_BINARY, b"tea")

@unittest.skipIf(
sys.version_info[:2] < (3, 11), "raise_exceptions requires Python 3.11+"
)
def test_broadcast_binary_reports_no_errors(self):
broadcast([self.protocol], b"tea", raise_exceptions=True)
self.assertOneFrameSent(True, OP_BINARY, b"tea")

def test_broadcast_type_error(self):
with self.assertRaises(TypeError):
broadcast([self.protocol], ["ca", "fé"])
Expand Down

0 comments on commit 96d3adf

Please sign in to comment.