Пример #1
0
 def it_should_have_relative_ref_for_internal_rel(self):
     """
     Internal relationships (TargetMode == 'Internal' in the XML) should
     have a relative ref, e.g. '../slideLayouts/slideLayout1.xml', for
     the target_ref attribute.
     """
     part = Mock(name='part', partname=PackURI('/ppt/media/image1.png'))
     baseURI = '/ppt/slides'
     rel = _Relationship(None, None, part, baseURI)  # external=False
     assert rel.target_ref == '../media/image1.png'
Пример #2
0
 def it_remembers_construction_values(self):
     # test data --------------------
     rId = 'rId9'
     reltype = 'reltype'
     target = Mock(name='target_part')
     external = False
     # exercise ---------------------
     rel = _Relationship(rId, reltype, target, None, external)
     # verify -----------------------
     assert rel.rId == rId
     assert rel.reltype == reltype
     assert rel.target_part == target
     assert rel.is_external == external
Пример #3
0
 def it_should_have_target_ref_for_external_rel(self):
     rel = _Relationship(None, None, 'target', None, external=True)
     assert rel.target_ref == 'target'
Пример #4
0
 def it_should_raise_on_target_part_access_on_external_rel(self):
     rel = _Relationship(None, None, None, None, external=True)
     with pytest.raises(ValueError):
         rel.target_part
Пример #5
0
 def _rel_with_known_target_part(
         self, _rId, reltype, _target_part, _baseURI):
     rel = _Relationship(_rId, reltype, _target_part, _baseURI)
     return rel, _rId, _target_part