def test_membership_normalized(self): mapping = base.PackageKeyMapping(not_normalized=1) self.assertIn(safe_name('not_normalized'), mapping) self.assertIn('not_normalized', mapping)
def test_pop_normalized(self): mapping = base.PackageKeyMapping(not_normalized=1) mapping.pop('not_normalized') self.assertEqual(0, len(mapping))
def test_iter(self): mapping = base.PackageKeyMapping({'foo': 1, 'bar': 2}) values = {v for k, v in mapping.items()} self.assertEqual({1, 2}, values)
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')])
def test_get(self): mapping = base.PackageKeyMapping(foo=1) self.assertEqual(mapping['foo'], 1) self.assertEqual(mapping.get('foo'), 1)
def test_membership(self): mapping = base.PackageKeyMapping(foo=1) self.assertIn('foo', mapping) self.assertNotIn('bar', mapping)
def test_delete(self): mapping = base.PackageKeyMapping(foo=1) del mapping['foo'] self.assertEqual(0, len(mapping))
def test_len(self): mapping = base.PackageKeyMapping() self.assertEqual(0, len(mapping)) mapping['foo'] = 1 self.assertEqual(1, len(mapping))
def test_repr(self): mapping = base.PackageKeyMapping() self.assertEqual('{}', repr(mapping)) mapping['a'] = 1 self.assertEqual("{'a': 1}", repr(mapping))