1
0

922_py_compile.py 462 B

1234567891011121314151617181920212223242526
  1. try:
  2. import os
  3. except ImportError:
  4. print('os is not enabled, skipping test...')
  5. exit(0)
  6. import sys
  7. if sys.platform == 'win32':
  8. exe_name = 'main.exe'
  9. else:
  10. exe_name = './main'
  11. assert os.system(f'{exe_name} --compile python/heapq.py heapq1.pyc') == 0
  12. assert os.path.exists('heapq1.pyc')
  13. import heapq1
  14. import heapq
  15. a = [1, 2, -3, 2, 1, 5, 11, 123] * 10
  16. b = a.copy()
  17. heapq.heapify(a)
  18. heapq1.heapify(b)
  19. assert a == b
  20. os.remove('heapq1.pyc')