本文整理汇总了Python中wagtail.wagtailimages.formats.Format类的典型用法代码示例。如果您正苦于以下问题:Python Format类的具体用法?Python Format怎么用?Python Format使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Format类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: TestFormat
class TestFormat(TestCase):
def setUp(self):
# test format
self.format = Format("test name", "test label", "test classnames", "test filter spec")
# test image
self.image = MagicMock()
self.image.id = 0
def test_editor_attributes(self):
result = self.format.editor_attributes(self.image, "test alt text")
self.assertEqual(result, 'data-embedtype="image" data-id="0" data-format="test name" data-alt="test alt text" ')
def test_image_to_editor_html(self):
result = self.format.image_to_editor_html(self.image, "test alt text")
six.assertRegex(
self,
result,
'<img data-embedtype="image" data-id="0" data-format="test name" data-alt="test alt text" class="test classnames" src="[^"]+" width="1" height="1" alt="test alt text">',
)
def test_image_to_html_no_classnames(self):
self.format.classnames = None
result = self.format.image_to_html(self.image, "test alt text")
six.assertRegex(self, result, '<img src="[^"]+" width="1" height="1" alt="test alt text">')
self.format.classnames = "test classnames"
def test_get_image_format(self):
register_image_format(self.format)
result = get_image_format("test name")
self.assertEqual(result, self.format)
开发者ID:carriercomm,项目名称:wagtail,代码行数:30,代码来源:tests.py
示例2: setUp
def setUp(self):
# test format
self.format = Format(
'test name',
'test label',
'test classnames',
'test filter spec'
)
# test image
self.image = MagicMock()
self.image.id = 0
开发者ID:Gavryush,项目名称:wagtail,代码行数:11,代码来源:tests.py
示例3: setUp
def setUp(self):
# test format
self.format = Format("test name", "test label", "test classnames", "test filter spec")
# test image
self.image = MagicMock()
self.image.id = 0
开发者ID:carriercomm,项目名称:wagtail,代码行数:6,代码来源:tests.py
注:本文中的wagtail.wagtailimages.formats.Format类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论