class PeriodAdaptationSetsRelationshipTest(unittest.TestCase): def setUp(self): self.period = Period() def test_period_adaptation_sets_relationship(self): assert is_instance_method(self.period.adaptation_sets) assert self.period.adaptation_sets() == [] def test_period_add_adaptation_set_with_degenerate_input(self): assert is_instance_method(self.period.append_adaptation_set) self.assertRaises(TypeError, self.period.append_adaptation_set, None) self.assertRaises(TypeError, self.period.append_adaptation_set, '') self.assertRaises(TypeError, self.period.append_adaptation_set, 0) self.assertRaises(TypeError, self.period.append_adaptation_set, 0.0) def test_period_add_single_adaptation_Set(self): adaptation_set = AdaptationSet() self.period.append_adaptation_set(adaptation_set) xml = etree.fromstring(self.period.to_xml()) assert len(xml.getchildren()) > 0
def test_period_xml_serialization(self): period = Period() assert 'to_xml' in dir(period) assert isinstance(period.to_xml(), basestring) assert period.to_xml().startswith('<?xml') assert etree.fromstring(period.to_xml()).tag == 'Period'