Пример #1
0
    def test_save_to_data(self):
        metadata = Metadata()
        metadata.set_property('version', 'v0.1')
        metadata.set_property('summary', {'title': 'test_title'})

        data = metadata.save_to_data()

        metadata = Metadata()
        metadata.load_from_data(data)
        self.assertEqual(metadata['version'], 'v0.1')
        self.assertEqual(metadata['summary']['title'], 'test_title')
Пример #2
0
    def test_load_from_data_invalid(self):
        metadata = Metadata()

        with self.assertRaises(yaml.YAMLError):
            metadata.load_from_data("{{{}} invalid")
Пример #3
0
    def test_load_from_data(self):
        metadata = Metadata()
        metadata.load_from_data("version: v0.1")

        self.assertEqual(metadata['version'], 'v0.1')