| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | import unittest | 
					
						
							|  |  |  | from unittest import mock | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import asyncio | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-10 14:57:20 +02:00
										 |  |  | def tearDownModule(): | 
					
						
							|  |  |  |     # not needed for the test file but added for uniformness with all other | 
					
						
							|  |  |  |     # asyncio test files for the sake of unified cleanup | 
					
						
							| 
									
										
										
										
											2024-12-18 11:35:29 +05:30
										 |  |  |     asyncio._set_event_loop_policy(None) | 
					
						
							| 
									
										
										
										
											2022-02-10 14:57:20 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | class ProtocolsAbsTests(unittest.TestCase): | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     def test_base_protocol(self): | 
					
						
							|  |  |  |         f = mock.Mock() | 
					
						
							|  |  |  |         p = asyncio.BaseProtocol() | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_made(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_lost(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.pause_writing()) | 
					
						
							|  |  |  |         self.assertIsNone(p.resume_writing()) | 
					
						
							| 
									
										
										
										
											2025-01-20 13:32:39 +02:00
										 |  |  |         self.assertNotHasAttr(p, '__dict__') | 
					
						
							| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_protocol(self): | 
					
						
							|  |  |  |         f = mock.Mock() | 
					
						
							|  |  |  |         p = asyncio.Protocol() | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_made(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_lost(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.data_received(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.eof_received()) | 
					
						
							|  |  |  |         self.assertIsNone(p.pause_writing()) | 
					
						
							|  |  |  |         self.assertIsNone(p.resume_writing()) | 
					
						
							| 
									
										
										
										
											2025-01-20 13:32:39 +02:00
										 |  |  |         self.assertNotHasAttr(p, '__dict__') | 
					
						
							| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_buffered_protocol(self): | 
					
						
							|  |  |  |         f = mock.Mock() | 
					
						
							|  |  |  |         p = asyncio.BufferedProtocol() | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_made(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.connection_lost(f)) | 
					
						
							|  |  |  |         self.assertIsNone(p.get_buffer(100)) | 
					
						
							|  |  |  |         self.assertIsNone(p.buffer_updated(150)) | 
					
						
							|  |  |  |         self.assertIsNone(p.pause_writing()) | 
					
						
							|  |  |  |         self.assertIsNone(p.resume_writing()) | 
					
						
							| 
									
										
										
										
											2025-01-20 13:32:39 +02:00
										 |  |  |         self.assertNotHasAttr(p, '__dict__') | 
					
						
							| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_datagram_protocol(self): | 
					
						
							|  |  |  |         f = mock.Mock() | 
					
						
							|  |  |  |         dp = asyncio.DatagramProtocol() | 
					
						
							|  |  |  |         self.assertIsNone(dp.connection_made(f)) | 
					
						
							|  |  |  |         self.assertIsNone(dp.connection_lost(f)) | 
					
						
							|  |  |  |         self.assertIsNone(dp.error_received(f)) | 
					
						
							|  |  |  |         self.assertIsNone(dp.datagram_received(f, f)) | 
					
						
							| 
									
										
										
										
											2025-01-20 13:32:39 +02:00
										 |  |  |         self.assertNotHasAttr(dp, '__dict__') | 
					
						
							| 
									
										
										
										
											2018-12-11 19:07:05 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |     def test_subprocess_protocol(self): | 
					
						
							|  |  |  |         f = mock.Mock() | 
					
						
							|  |  |  |         sp = asyncio.SubprocessProtocol() | 
					
						
							|  |  |  |         self.assertIsNone(sp.connection_made(f)) | 
					
						
							|  |  |  |         self.assertIsNone(sp.connection_lost(f)) | 
					
						
							|  |  |  |         self.assertIsNone(sp.pipe_data_received(1, f)) | 
					
						
							|  |  |  |         self.assertIsNone(sp.pipe_connection_lost(1, f)) | 
					
						
							|  |  |  |         self.assertIsNone(sp.process_exited()) | 
					
						
							| 
									
										
										
										
											2025-01-20 13:32:39 +02:00
										 |  |  |         self.assertNotHasAttr(sp, '__dict__') | 
					
						
							| 
									
										
										
										
											2022-01-22 14:06:27 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if __name__ == '__main__': | 
					
						
							|  |  |  |     unittest.main() |