ó {G_Tc@sšddlZddlZddlZddlZddlZddlmZd„Zd„Zdej fd„ƒYZ d„Z e dkr–e ƒndS( iÿÿÿÿN(t test_supportcCs…tj|ƒ}xb|D]Z}tjj||ƒ}tjj|ƒrctjj|ƒ rct|ƒqtj|ƒqWtj|ƒdS(N( tostlistdirtpathtjointisdirtislinktcleanouttremovetrmdir(troottnamestnametfullname((s)/usr/local/lib/python2.7/test/test_pkg.pyR s % cCs d|kr|jdƒn|S(Nt __builtins__(R(tlst((s)/usr/local/lib/python2.7/test/test_pkg.pytfixdirs tTestcBs’eZd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z e jejjd kd ƒd „ƒZRS(cCs(d|_d|_ttjƒ|_dS(N(tNoneR tpkgnametlisttsysRtsyspath(tself((s)/usr/local/lib/python2.7/test/test_pkg.pytsetUp/s  cCs…|jtj(|jr&t|jƒn|jrgtjD]$}|j|jdƒkr9|^q9}x|D]}tj|=qjWndS(Nt.(RRRR RRtmodulestsplit(RR R((s)/usr/local/lib/python2.7/test/test_pkg.pyttearDown4s   $ cBs(ej|ƒeƒi|d6fdUdS(NR(ttextwraptdedenttglobals(Rtcode((s)/usr/local/lib/python2.7/test/test_pkg.pytrun_code@sc Cstjƒ}tjjd|ƒtjj|ƒsAtj|ƒnx´|D]¬\}}|jƒ}|}x#|D]}tjj ||ƒ}qmW|dkr¨tj|ƒqHt |dƒ}|j |ƒ|rê|ddkrê|j dƒn|j ƒqHW||_|dd|_dS(Nitwiÿÿÿÿs (ttempfiletmkdtempRRtinsertRRtmkdirRRRtopentwritetcloseR R( RtdescrR R tcontentstcompsR tctf((s)/usr/local/lib/python2.7/test/test_pkg.pytmkhierCs$      cCs:ddtjddfg}|j|ƒddl}dS(Ntt1s t1 __init__tpytiÿÿÿÿ(st1N(RRtextsepR/R0(RthierR0((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_1Ys cCsÚddtjddfddtjddfdd tjdd fg}|j|ƒd dl}d dl}|j|jdƒ|j|jjd ƒ|j|jj jd ƒd}|j |ƒd dl m}d dlm }d dlm }|j|jd ƒ|j|jd ƒ|j|j jd ƒx5ddddgD]!}|j tƒdd|ƒqDWd dl}d dl}|j|jdƒ|j|jjd ƒ|j|jj jd ƒd}|j |ƒdS(Ntt2s t2 __init__R1s 'doc for t2'st2 subst2 sub __init__R2s t2 sub subsubst2 sub subsub __init__sspam = 1iÿÿÿÿst2.subs t2.sub.subsubs{ import t2 from t2 import * self.assertEqual(dir(), ['self', 'sub', 't2']) (tsub(tsubsub(tspamR9R7R8R sFailed to import %ss^ from t2 import * self.assertTrue(dir(), ['self', 'sub']) (st2N(st2 subN(s t2 sub subsubN(RRR3R/tt2.subt t2.sub.subsubt assertEqualt__name__R7R8R!R6R9t assertTruetlocals(RR4R6tsR7R8R9R ((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_2^s:      cCsªd dtjddfddtjddfddtjdd fg}|j|ƒd dl}|j|jdƒ|j|jjd ƒ|j|jjjd ƒdS(Ntt3s t3 __init__R1R2st3 subst3 sub __init__s t3 sub subsubst3 sub subsub __init__sspam = 1iÿÿÿÿst3.subs t3.sub.subsub(st3N(st3 subN(s t3 sub subsubN( RRR3R/t t3.sub.subsubR<R=R7R8(RR4RB((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_3s  c Cs‰dddtjddfddd tjddfd tjdd fdd tjddfg }|j|ƒd}|j|ƒdS(Nst4.pys)raise RuntimeError('Shouldnt load t4.py')tt4s t4 __init__R1R2s t4 sub.pys*raise RuntimeError('Shouldnt load sub.py')st4 subst4 sub __init__s t4 sub subsubs-raise RuntimeError('Shouldnt load subsub.py')st4 sub subsub __init__sspam = 1s[ from t4.sub.subsub import * self.assertEqual(spam, 1) (st4.pys)raise RuntimeError('Shouldnt load t4.py')(REN(s t4 sub.pys*raise RuntimeError('Shouldnt load sub.py')(st4 subN(s t4 sub subsubN(RRR3R/R!(RR4R@((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_4s c Csddtjddfdtjddfdtjddfg}|j|ƒd dl}d }|j|ƒd dl}|jtt|ƒƒd d d dddddgƒ|jtt|j ƒƒd d d ddgƒ|jtt|j ƒƒd d d ddgƒdS(Ntt5s t5 __init__R1s import t5.foos t5 stringsspam = 1st5 foos-from . import string; assert string.spam == 1iÿÿÿÿso from t5 import * self.assertEqual(dir(), ['foo', 'self', 'string', 't5']) t__doc__t__file__R=t __package__t__path__tfootstringR9(st5N( RRR3R/RGR!R<RtdirRLRM(RR4RGR@((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_5²s&         cCs·ddtjddfdtjddfdtjddfdtjddfg}|j|ƒd dl}|jtt|ƒƒd d d d ddgƒd}|j|ƒdS(Ntt6s t6 __init__R1s!__all__ = ['spam', 'ham', 'eggs']st6 spamR2st6 hamst6 eggsiÿÿÿÿt__all__RHRIR=RJRKst import t6 from t6 import * self.assertEqual(fixdir(dir(t6)), ['__all__', '__doc__', '__file__', '__name__', '__package__', '__path__', 'eggs', 'ham', 'spam']) self.assertEqual(dir(), ['eggs', 'ham', 'self', 'spam', 't6']) (st6N( RRR3R/RPR<RRNR!(RR4RPR@((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_6Îs    c Csìddtjddfdtjddfdtjddfddtjddfdtjdd fdd tjdd fg }|j|ƒd\}}}d dl}|jtt|ƒƒdddddgƒ|j|ƒd dlm }|jtt|ƒƒdddddgƒ|j|ƒ|j|ƒd dl m }|jtt|ƒƒddddddgƒ|j|ƒ|j|ƒ|j|ƒd dl m }|j|dƒ|j|ƒ|j|ƒ|j|ƒdS(Ntt7R1R2s t7 __init__st7 subs*raise RuntimeError('Shouldnt load sub.py')st7 sub __init__st7 sub s-raise RuntimeError('Shouldnt load subsub.py')s t7 sub subsubst7 sub subsub __init__sspam = 1iÿÿÿÿRHRIR=RJRK(R7(R8R9(R9i(st7N(st7 subN(s t7 sub subsubN(NNN(RRR3R/RSR<RRNt assertFalseR7tt7.subR8t t7.sub.subsubR9( RR4RSR7R8ttastsubpart subsubsubtham((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_7èsJ                is)Docstrings are omitted with -O2 and abovecCsMddtjddfg}|j|ƒddl}|j|jdƒdS(Ntt8s t8 __init__R1s 'doc for t8'iÿÿÿÿs doc for t8(st8N(RRR3R/R\R<RH(RR4R\((s)/usr/local/lib/python2.7/test/test_pkg.pyttest_8s   (R=t __module__RRR!R/R5RARDRFRORRR[tunittesttskipIfRtflagstoptimizeR](((s)/usr/local/lib/python2.7/test/test_pkg.pyR-s     /     +cCstjtƒdS(N(Rt run_unittestR=(((s)/usr/local/lib/python2.7/test/test_pkg.pyt test_mainst__main__( RRR#RR_ttestRRRtTestCaseRRdR=(((s)/usr/local/lib/python2.7/test/test_pkg.pyts      ò