-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_py27.py
More file actions
43 lines (34 loc) · 1.07 KB
/
test_py27.py
File metadata and controls
43 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test script for Python 2.7 compatibility
"""
from __future__ import print_function, unicode_literals
import sys
import os
print("Python version:", sys.version)
print("Python executable:", sys.executable)
# Add the current directory to the path
sys.path.insert(0, os.path.abspath('.'))
try:
# Test basic import
print("\nTesting basic import...")
import load
print("Successfully imported load module")
print("Load version:", load.__version__)
# Test basic functionality
print("\nTesting basic functionality...")
math = load('math')
print("Imported math module:", math)
print("math.sqrt(16) =", math.sqrt(16))
# Test auto-print
print("\nTesting auto-print...")
load.enable_auto_print()
result = load('math.sqrt(25)')
print("Result of load('math.sqrt(25)'):", result)
print("\nPython 2.7 compatibility tests completed successfully!")
except Exception as e:
print("\nError during testing:", str(e))
import traceback
traceback.print_exc()
sys.exit(1)