Exemplo n.º 1
0
 def test_mapper_apis(self):
     PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
     content = open(PKG_INFO).read()
     content = content % sys.platform
     metadata = DistributionMetadata()
     metadata.read_file(StringIO(content))
     self.assertIn('Version', metadata.keys())
     self.assertIn('0.5', metadata.values())
     self.assertIn(('Version', '0.5'), metadata.items())
Exemplo n.º 2
0
    def test_mapping_api(self):
        PKG_INFO = os.path.join(os.path.dirname(__file__), 'PKG-INFO')
        content = open(PKG_INFO).read()
        content = content % sys.platform
        metadata = DistributionMetadata(fileobj=StringIO(content))
        self.assertIn('Version', metadata.keys())
        self.assertIn('0.5', metadata.values())
        self.assertIn(('Version', '0.5'), metadata.items())

        metadata.update({'version': '0.6'})
        self.assertEqual(metadata['Version'], '0.6')
        metadata.update([('version', '0.7')])
        self.assertEqual(metadata['Version'], '0.7')