922_py_compile.py 366 B

1234567891011121314151617181920212223
  1. from py_compile import compile
  2. try:
  3. import os
  4. except ImportError:
  5. print('os is not enabled, skipping test...')
  6. exit(0)
  7. compile('python/heapq.py', 'heapq1.pyc')
  8. assert os.path.exists('heapq1.pyc')
  9. import heapq1
  10. import heapq
  11. a = [1, 2, -3, 2, 1, 5, 11, 123] * 10
  12. b = a.copy()
  13. heapq.heapify(a)
  14. heapq1.heapify(b)
  15. assert a == b
  16. os.remove('heapq1.pyc')