Beispiel #1
0
	def test_decode(self):
		for applicationLevel in (True, False):
			for reasonString in ('the reason', 'the | | reason', '', '|', '||'):
				s = reasonString + '|' + str(int(applicationLevel)) + '!'
				self.assertEqual(
					ResetFrame(reasonString, applicationLevel),
					ResetFrame.decode(sf(s)))
Beispiel #2
0
	def test_decodeFailedBadBoolean(self):
		s = 'reason|2!'
		self.assertRaises(
			InvalidFrame,
			lambda: ResetFrame.decode(sf(s)))
Beispiel #3
0
	def test_decodeFailedBadReason(self):
		s = '\x7freason|0!'
		self.assertRaises(
			InvalidFrame,
			lambda: ResetFrame.decode(sf(s)))