示例#1
0
 def test_membership_normalized(self):
     mapping = base.PackageKeyMapping(not_normalized=1)
     self.assertIn(safe_name('not_normalized'), mapping)
     self.assertIn('not_normalized', mapping)
示例#2
0
 def test_pop_normalized(self):
     mapping = base.PackageKeyMapping(not_normalized=1)
     mapping.pop('not_normalized')
     self.assertEqual(0, len(mapping))
示例#3
0
 def test_iter(self):
     mapping = base.PackageKeyMapping({'foo': 1, 'bar': 2})
     values = {v for k, v in mapping.items()}
     self.assertEqual({1, 2}, values)
示例#4
0
 def test_distribution_as_key(self):
     mapping = base.PackageKeyMapping()
     mapping[Distribution(project_name='not_normalized')] = 1
     self.assertEqual(1, mapping['not_normalized'])
     self.assertEqual(1, mapping[safe_name('not_normalized')])
示例#5
0
 def test_get(self):
     mapping = base.PackageKeyMapping(foo=1)
     self.assertEqual(mapping['foo'], 1)
     self.assertEqual(mapping.get('foo'), 1)
示例#6
0
 def test_membership(self):
     mapping = base.PackageKeyMapping(foo=1)
     self.assertIn('foo', mapping)
     self.assertNotIn('bar', mapping)
示例#7
0
 def test_delete(self):
     mapping = base.PackageKeyMapping(foo=1)
     del mapping['foo']
     self.assertEqual(0, len(mapping))
示例#8
0
 def test_len(self):
     mapping = base.PackageKeyMapping()
     self.assertEqual(0, len(mapping))
     mapping['foo'] = 1
     self.assertEqual(1, len(mapping))
示例#9
0
 def test_repr(self):
     mapping = base.PackageKeyMapping()
     self.assertEqual('{}', repr(mapping))
     mapping['a'] = 1
     self.assertEqual("{'a': 1}", repr(mapping))