def test_attr(self): m = ini.WrapMeta() for attr in ('description', 'homepage'): setattr(m, attr, 'hello world') self.assertEqual(getattr(m, attr), 'hello world') self.assertTrue(getattr(m, 'has_' + attr)) self.assertTrue(m.has(attr))
def get_metadata(self, name: str) -> Optional[ini.WrapMeta]: meta = self._metadata.get(name) if not meta: return None wm = ini.WrapMeta() for key, value in meta.items(): setattr(wm, key, value) return wm
def test_write(self): m = ini.WrapMeta() m.description = 'hello world' s = m.write_string() self.assertIn('hello world', s) self.assertIn('[metadata]', s)