PATH: //proc/thread-self/root/opt/alt/python311/lib64/python3.11/test/test_asyncio
FILE_BARU
CREATE
FOLDER_BARU
MKDIR
UPLOAD_FILE
GO
[ .. KEMBALI ]
📄 __init__.py
↓
X
📄 __main__.py
↓
X
📁 __pycache__/
X
📄 echo.py
↓
X
📄 echo2.py
↓
X
📄 echo3.py
↓
X
📄 functional.py
↓
X
📄 test_base_events.py
↓
X
📄 test_buffered_proto.py
↓
X
📄 test_context.py
↓
X
📄 test_events.py
↓
X
📄 test_futures.py
↓
X
📄 test_futures2.py
↓
X
📄 test_locks.py
↓
X
📄 test_pep492.py
↓
X
📄 test_proactor_events.py
↓
X
📄 test_protocols.py
↓
X
📄 test_queues.py
↓
X
📄 test_runners.py
↓
X
📄 test_selector_events.py
↓
X
📄 test_sendfile.py
↓
X
📄 test_server.py
↓
X
📄 test_sock_lowlevel.py
↓
X
📄 test_ssl.py
↓
X
📄 test_sslproto.py
↓
X
📄 test_streams.py
↓
X
📄 test_subprocess.py
↓
X
📄 test_taskgroups.py
↓
X
📄 test_tasks.py
↓
X
📄 test_threads.py
↓
X
📄 test_timeouts.py
↓
X
📄 test_transports.py
↓
X
📄 test_unix_events.py
↓
X
📄 test_waitfor.py
↓
X
📄 test_windows_events.py
↓
X
📄 test_windows_utils.py
↓
X
📄 utils.py
↓
X
SAVING...
BERHASIL DIUBAH!
EDITING: test_context.py
import asyncio import decimal import unittest def tearDownModule(): asyncio.set_event_loop_policy(None) @unittest.skipUnless(decimal.HAVE_CONTEXTVAR, "decimal is built with a thread-local context") class DecimalContextTest(unittest.TestCase): def test_asyncio_task_decimal_context(self): async def fractions(t, precision, x, y): with decimal.localcontext() as ctx: ctx.prec = precision a = decimal.Decimal(x) / decimal.Decimal(y) await asyncio.sleep(t) b = decimal.Decimal(x) / decimal.Decimal(y ** 2) return a, b async def main(): r1, r2 = await asyncio.gather( fractions(0.1, 3, 1, 3), fractions(0.2, 6, 1, 3)) return r1, r2 r1, r2 = asyncio.run(main()) self.assertEqual(str(r1[0]), '0.333') self.assertEqual(str(r1[1]), '0.111') self.assertEqual(str(r2[0]), '0.333333') self.assertEqual(str(r2[1]), '0.111111') if __name__ == '__main__': unittest.main()
SIMPAN PERUBAHAN