<s> from __future__ import absolute_import <EOL> from __future__ import print_function <EOL> from __future__ import division <EOL> import unittest <EOL> from pycopia import aid <EOL> from pycopia import dictlib <EOL> from pycopia import UserFile <EOL> from pycopia import getopt <EOL> from pycopia import gzip <EOL> from pycopia import socket <EOL> from pycopia import timelib <EOL> from pycopia import tty <EOL> from pycopia import urlparse <EOL> from pycopia import textutils <EOL> from pycopia import timespec <EOL> class MyBaseClass ( object ) : <EOL> pass <EOL> class AidTests ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> pass <EOL> def test_mapstr ( self ) : <EOL> TEST = aid . mapstr ( "<STR_LIT>" ) <EOL> print ( TEST . attributes ) <EOL> try : <EOL> print ( TEST ) <EOL> except ValueError : <EOL> print ( "<STR_LIT>" % TEST ) <EOL> TEST . one = "<STR_LIT>" <EOL> TEST . two = "<STR_LIT>" <EOL> TEST . three = "<STR_LIT>" <EOL> print ( TEST ) <EOL> s = str ( TEST ) <EOL> assert s == "<STR_LIT>" <EOL> print ( TEST . three ) <EOL> def test_formatstr ( self ) : <EOL> src = "<STR_LIT>" <EOL> fmt = aid . formatstr ( src ) <EOL> assert src . format ( one = "<STR_LIT>" , two = "<STR_LIT>" ) == fmt ( one = "<STR_LIT>" , two = "<STR_LIT>" ) <EOL> assert fmt . attributes == [ "<STR_LIT>" , "<STR_LIT>" ] <EOL> def test_newclass ( self ) : <EOL> New = aid . newclass ( "<STR_LIT>" , MyBaseClass ) <EOL> print ( New ( ) ) <EOL> def test_AttrDictWrapper ( self ) : <EOL> ld = { "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:3> } <EOL> gd = { "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT>" : <NUM_LIT:2> , "<STR_LIT>" : <NUM_LIT:3> } <EOL> lw = dictlib . AttrDictWrapper ( ld ) <EOL> lw . four = gd <EOL> print ( lw . one ) <EOL> print ( lw . two ) <EOL> print ( lw . four . gbone ) <EOL> print ( lw . four [ "<STR_LIT>" ] ) <EOL> def test_AttrDict ( self ) : <EOL> d = dictlib . AttrDict ( ) <EOL> d . one = "<STR_LIT>" <EOL> print ( d ) <EOL> print ( d . get ) <EOL> print ( d . one ) <EOL> print ( d [ "<STR_LIT>" ] ) <EOL> d [ "<STR_LIT>" ] = <NUM_LIT:2> <EOL> print ( d . two ) <EOL> print ( d [ "<STR_LIT>" ] ) <EOL> def test_UserFile ( self ) : <EOL> fd = UserFile . UserFile ( "<STR_LIT>" , "<STR_LIT:rb>" ) <EOL> while <NUM_LIT:1> : <EOL> d = fd . read ( <NUM_LIT> ) <EOL> if not d : <EOL> break <EOL> fd . close ( ) <EOL> def test_timelib ( self ) : <EOL> mt = timelib . localtime_mutable ( ) <EOL> print ( mt ) <EOL> mt . add_seconds ( <NUM_LIT> ) <EOL> print ( mt ) <EOL> print ( timelib . strftime ( "<STR_LIT>" , timelib . weekof ( timelib . time ( ) ) ) ) <EOL> t = timelib . now ( ) <EOL> for d in range ( <NUM_LIT:1> , <NUM_LIT> ) : <EOL> week = timelib . weekof ( t + ( d * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> ) ) <EOL> print ( timelib . MutableTime ( week ) ) <EOL> print ( "<STR_LIT>" ) <EOL> print ( timelib . localtimestamp ( ) ) <EOL> p = timespec . TimespecParser ( ) <EOL> for spec , secs in [ <EOL> ( "<STR_LIT>" , <NUM_LIT:0.0> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , - <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , - <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) , <EOL> ( "<STR_LIT>" , <NUM_LIT> ) ] : <EOL> p . parse ( spec ) <EOL> self . assert_ ( p . seconds == secs ) <EOL> self . assertRaises ( ValueError , p . parse , "<STR_LIT>" ) <EOL> def XXXtest_tty_SerialPort ( self ) : <EOL> sp = tty . SerialPort ( "<STR_LIT>" ) <EOL> sp . set_serial ( "<STR_LIT>" ) <EOL> sp . stty ( "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , <EOL> "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" , "<STR_LIT>" ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
