本文整理汇总了Python中test._common.platform_posix函数的典型用法代码示例。如果您正苦于以下问题:Python platform_posix函数的具体用法?Python platform_posix怎么用?Python platform_posix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了platform_posix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_formatted_datetime
def test_get_formatted_datetime(self):
with _common.platform_posix():
self.i.added = 1368302461.210265
val = self.i.formatted().get('added')
self.assertTrue(val.startswith('2013'))
示例2: test_get_formatted_none
def test_get_formatted_none(self):
with _common.platform_posix():
self.i.some_other_field = None
val = self.i.formatted().get('some_other_field')
self.assertEqual(val, u'')
示例3: test_get_formatted_uses_kbps_bitrate
def test_get_formatted_uses_kbps_bitrate(self):
with _common.platform_posix():
self.i.bitrate = 12345
val = self.i.formatted().get('bitrate')
self.assertEqual(val, u'12kbps')
示例4: test_get_formatted_uses_khz_samplerate
def test_get_formatted_uses_khz_samplerate(self):
with _common.platform_posix():
self.i.samplerate = 12345
val = self.i.formatted().get('samplerate')
self.assertEqual(val, u'12kHz')
示例5: test_get_formatted_does_not_replace_separators
def test_get_formatted_does_not_replace_separators(self):
with _common.platform_posix():
name = os.path.join('a', 'b')
self.i.title = name
newname = self.i.formatted().get('title')
self.assertEqual(name, newname)
示例6: test_get_formatted_pads_with_zero
def test_get_formatted_pads_with_zero(self):
with _common.platform_posix():
self.i.track = 1
name = self.i.formatted().get('track')
self.assertTrue(name.startswith('0'))
示例7: test_sanitize_with_custom_replace_adds_replacements
def test_sanitize_with_custom_replace_adds_replacements(self):
with _common.platform_posix():
p = util.sanitize_path(u'foo/bar', [
(re.compile(r'foo'), u'bar'),
])
self.assertEqual(p, u'bar/bar')
示例8: test_truncate_bytestring
def test_truncate_bytestring(self):
with _common.platform_posix():
p = util.truncate_path(b'abcde/fgh', 4)
self.assertEqual(p, b'abcd/fgh')
示例9: test_sanitize_path_works_on_empty_string
def test_sanitize_path_works_on_empty_string(self):
with _common.platform_posix():
p = util.sanitize_path(u'')
self.assertEqual(p, u'')
示例10: test_sanitize_with_custom_replace_overrides_built_in_sub
def test_sanitize_with_custom_replace_overrides_built_in_sub(self):
with _common.platform_posix():
p = util.sanitize_path(u'a/.?/b', [
(re.compile(r'foo'), u'bar'),
])
self.assertEqual(p, u'a/.?/b')
示例11: test_sanitize_unix_replaces_leading_dot
def test_sanitize_unix_replaces_leading_dot(self):
with _common.platform_posix():
p = util.sanitize_path(u'one/.two/three')
self.assertFalse(u'.' in p)
示例12: test_truncate_preserves_extension
def test_truncate_preserves_extension(self):
with _common.platform_posix():
p = util.truncate_path(u'abcde/fgh.ext', 5)
self.assertEqual(p, u'abcde/f.ext')
示例13: test_truncate_unicode
def test_truncate_unicode(self):
with _common.platform_posix():
p = util.truncate_path(u'abcde/fgh', 4)
self.assertEqual(p, u'abcd/fgh')
示例14: _assert_dest
def _assert_dest(self, dest, i=None):
if i is None:
i = self.i
with _common.platform_posix():
actual = i.destination()
self.assertEqual(actual, dest)
示例15: test_sanitize_empty_component
def test_sanitize_empty_component(self):
with _common.platform_posix():
p = util.sanitize_path(u'foo//bar', [
(re.compile(r'^$'), u'_'),
])
self.assertEqual(p, u'foo/_/bar')