1 from test_support
import TESTFN
, TestFailed
7 # Brief digression to test that import is case-sensitive: if we got this
8 # far, we know for sure that "random" exists.
14 raise TestFailed("import of RAnDoM should have failed (case mismatch)")
16 # Another brief digression to test the accuracy of manifest float constants.
17 import double_const
# don't blink -- that *was* the test
19 sys
.path
.insert(0, os
.curdir
)
21 source
= TESTFN
+ ".py"
26 print >> f
, "# This will test Python's ability to import a .py file"
27 a
= random
.randrange(1000)
28 b
= random
.randrange(1000)
35 mod
= __import__(TESTFN
)
36 except ImportError, err
:
37 raise ValueError, "import from .py failed: %s" % err
39 if mod
.a
!= a
or mod
.b
!= b
:
42 raise ValueError, "module loaded (%s) but contents invalid" % mod
49 except ImportError, err
:
50 raise ValueError, "import from .pyc/.pyo failed: %s" % err