def test_unsupported_resource_file(): """ Fail if passed resource is not supported by the integration with compare-locales. """ with pytest.raises(UnsupportedResourceTypeError): cast_to_compare_locales(".random_ext", None, None)
def test_unsupported_resource_file(): """ Fail if passed resource is not supported by the integration with compare-locales. """ with pytest.raises(UnsupportedResourceTypeError): cast_to_compare_locales('.random_ext', None, None)
def test_cast_to_properties(entity_with_comment, translation_a, entity_a): """ Cast entities from .properties resources to PropertiesEntity """ refEnt, transEnt = cast_to_compare_locales( ".properties", entity_with_comment, translation_a.string ) assert isinstance(refEnt, ComparePropertiesEntity) assert isinstance(transEnt, ComparePropertiesEntity) assert refEnt.key == "key_entity_a" assert refEnt.val == entity_a.string assert refEnt.pre_comment.all == "example comment" assert transEnt.key == "key_entity_a" assert transEnt.val == "Translation for entity_a" assert transEnt.pre_comment.all == "example comment"
def test_cast_to_dtd(entity_with_comment, translation_a, entity_a): """ Cast entities from .dtd resources to DTDEntity """ refEnt, transEnt = cast_to_compare_locales(".dtd", entity_with_comment, translation_a.string) assert isinstance(refEnt, CompareDTDEntity) assert isinstance(transEnt, CompareDTDEntity) assert refEnt.key == "key_entity_a" assert refEnt.val == entity_a.string assert refEnt.pre_comment.all == "example comment" assert refEnt.all == '<!ENTITY key_entity_a "%s">' % entity_a.string assert transEnt.key == "key_entity_a" assert transEnt.val == "Translation for entity_a" assert transEnt.pre_comment.all == "example comment" assert transEnt.all == '<!ENTITY key_entity_a "Translation for entity_a">'
def test_cast_to_properties(entity_with_comment, translation_a, entity_a): """ Cast entities from .properties resources to PropertiesEntity """ refEnt, transEnt = cast_to_compare_locales( '.properties', entity_with_comment, translation_a.string ) assert isinstance(refEnt, ComparePropertiesEntity) assert isinstance(transEnt, ComparePropertiesEntity) assert refEnt.key == 'key_entity_a' assert refEnt.val == entity_a.string assert refEnt.pre_comment.all == 'example comment' assert transEnt.key == 'key_entity_a' assert transEnt.val == 'Translation for entity_a' assert transEnt.pre_comment.all == 'example comment'
def test_cast_to_properties(entity_with_comment, translation0): """ Cast entities from .properties resources to PropertiesEntity """ refEnt, transEnt = cast_to_compare_locales( '.properties', entity_with_comment, translation0.string ) assert isinstance(refEnt, ComparePropertiesEntity) assert isinstance(transEnt, ComparePropertiesEntity) assert refEnt.key == 'KeyEntity0' assert refEnt.val == 'entity0' assert refEnt.pre_comment.all == 'example comment' assert transEnt.key == 'KeyEntity0' assert transEnt.val == 'Translation for entity0' assert transEnt.pre_comment.all == 'example comment'
def test_cast_to_dtd(entity_with_comment, translation_a, entity_a): """ Cast entities from .dtd resources to DTDEntity """ refEnt, transEnt = cast_to_compare_locales( '.dtd', entity_with_comment, translation_a.string ) assert isinstance(refEnt, CompareDTDEntity) assert isinstance(transEnt, CompareDTDEntity) assert refEnt.key == 'key_entity_a' assert refEnt.val == entity_a.string assert refEnt.pre_comment.all == 'example comment' assert refEnt.all == '<!ENTITY key_entity_a "%s">' % entity_a.string assert transEnt.key == 'key_entity_a' assert transEnt.val == 'Translation for entity_a' assert transEnt.pre_comment.all == 'example comment' assert transEnt.all == '<!ENTITY key_entity_a "Translation for entity_a">'
def test_cast_to_dtd(entity_with_comment, translation0): """ Cast entities from .dtd resources to DTDEntity """ refEnt, transEnt = cast_to_compare_locales( '.dtd', entity_with_comment, translation0.string ) assert isinstance(refEnt, CompareDTDEntity) assert isinstance(transEnt, CompareDTDEntity) assert refEnt.key == 'KeyEntity0' assert refEnt.val == 'entity0' assert refEnt.pre_comment.all == 'example comment' assert refEnt.all == '<!ENTITY KeyEntity0 "entity0">' assert transEnt.key == 'KeyEntity0' assert transEnt.val == 'Translation for entity0' assert transEnt.pre_comment.all == 'example comment' assert transEnt.all == '<!ENTITY KeyEntity0 "Translation for entity0">'