<s> from __future__ import ( absolute_import , division , generators , nested_scopes , print_function , <EOL> unicode_literals , with_statement ) <EOL> from pants_test . util . xml_test_base import XmlTestBase <EOL> from pants . contrib . android . android_manifest_parser import AndroidManifest , AndroidManifestParser <EOL> class TestAndroidManifestParser ( XmlTestBase ) : <EOL> """<STR_LIT>""" <EOL> def test_parse_manifest ( self ) : <EOL> with self . xml_file ( ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertEqual ( manifest . path , xml ) <EOL> def test_bad_parse_manifest ( self ) : <EOL> xml = '<STR_LIT>' <EOL> with self . assertRaises ( AndroidManifestParser . BadManifestError ) : <EOL> AndroidManifestParser . parse_manifest ( xml ) <EOL> def test_package_name ( self ) : <EOL> with self . xml_file ( ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertEqual ( manifest . package_name , '<STR_LIT>' ) <EOL> def test_missing_manifest_element ( self ) : <EOL> with self . xml_file ( manifest_element = '<STR_LIT>' ) as xml : <EOL> with self . assertRaises ( AndroidManifestParser . BadManifestError ) : <EOL> AndroidManifestParser . parse_manifest ( xml ) <EOL> def test_missing_package_attribute ( self ) : <EOL> with self . xml_file ( package_attribute = '<STR_LIT>' ) as xml : <EOL> with self . assertRaises ( AndroidManifestParser . BadManifestError ) : <EOL> AndroidManifestParser . parse_manifest ( xml ) <EOL> def test_weird_package_name ( self ) : <EOL> with self . xml_file ( package_value = '<STR_LIT>' ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertEqual ( manifest . package_name , '<STR_LIT>' ) <EOL> def test_target_sdk ( self ) : <EOL> with self . xml_file ( ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertEqual ( manifest . target_sdk , '<STR_LIT>' ) <EOL> def test_no_uses_sdk_element ( self ) : <EOL> with self . xml_file ( uses_sdk_element = '<STR_LIT>' ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertIsNone ( manifest . target_sdk ) <EOL> def test_no_target_sdk_value ( self ) : <EOL> with self . xml_file ( android_attribute = '<STR_LIT>' ) as xml : <EOL> parsed = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertIsNone ( parsed . target_sdk ) <EOL> def test_no_android_part ( self ) : <EOL> with self . xml_file ( android_attribute = '<STR_LIT>' ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertEqual ( manifest . package_name , '<STR_LIT>' ) <EOL> def test_missing_whole_targetsdk ( self ) : <EOL> with self . xml_file ( android_attribute = '<STR_LIT>' ) as xml : <EOL> manifest = AndroidManifestParser . parse_manifest ( xml ) <EOL> self . assertIsNone ( manifest . target_sdk ) <EOL> def test_android_manifest ( self ) : <EOL> with self . xml_file ( ) as xml : <EOL> test = AndroidManifest ( xml , '<STR_LIT>' , '<STR_LIT>' ) <EOL> self . assertEqual ( test . path , xml ) </s>
