<s> import os <EOL> import tempfile <EOL> from bento . compat . api . moves import unittest <EOL> from bento . core . package import PackageDescription <EOL> from bento . core . package import static_representation <EOL> from bento . core . meta import PackageMetadata <EOL> from bento . core . pkg_objects import DataFiles <EOL> from bento . core . node import Node <EOL> def create_file ( file , makedirs = True ) : <EOL> if makedirs : <EOL> dirname = os . path . dirname ( file ) <EOL> if not os . path . exists ( dirname ) : <EOL> os . makedirs ( dirname ) <EOL> fid = open ( file , "<STR_LIT:w>" ) . close ( ) <EOL> def clean_tree ( files ) : <EOL> dirs = [ ] <EOL> for f in files : <EOL> dirs . append ( os . path . dirname ( f ) ) <EOL> if os . path . exists ( f ) : <EOL> os . remove ( f ) <EOL> for d in sorted ( set ( dirs ) ) [ : : - <NUM_LIT:1> ] : <EOL> os . rmdir ( d ) <EOL> class TestStaticRepresentation ( unittest . TestCase ) : <EOL> def test_metadata ( self ) : <EOL> bento_info = """<STR_LIT>""" <EOL> self . _static_representation ( bento_info ) <EOL> def test_simple_library ( self ) : <EOL> bento_info = """<STR_LIT>""" <EOL> self . _static_representation ( bento_info ) <EOL> def _static_representation ( self , bento_info ) : <EOL> r_pkg = PackageDescription . from_string ( bento_info ) <EOL> pkg = PackageDescription . from_string ( static_representation ( r_pkg ) ) <EOL> self . assertEqual ( static_representation ( pkg ) , static_representation ( r_pkg ) ) <EOL> class TestPackageMetadata ( unittest . TestCase ) : <EOL> def test_ctor ( self ) : <EOL> meta = PackageMetadata ( name = "<STR_LIT:foo>" , version = "<STR_LIT:1.0>" , author = "<STR_LIT>" , <EOL> author_email = "<STR_LIT>" ) <EOL> self . assertEqual ( meta . fullname , "<STR_LIT>" ) <EOL> self . assertEqual ( meta . contact , "<STR_LIT>" ) <EOL> self . assertEqual ( meta . contact_email , "<STR_LIT>" ) </s>
