当前位置: 首页>>代码示例>>Python>>正文


Python Misc.dt_to_datestr方法代码示例

本文整理汇总了Python中Misc.dt_to_datestr方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.dt_to_datestr方法的具体用法?Python Misc.dt_to_datestr怎么用?Python Misc.dt_to_datestr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Misc的用法示例。


在下文中一共展示了Misc.dt_to_datestr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: RunTests

# 需要导入模块: import Misc [as 别名]
# 或者: from Misc import dt_to_datestr [as 别名]
    def RunTests(self):
        # Tests defined:
        testsNotToSkip = []
        startAtTest = 1  # Should start at 1, not 0!
        endAtTest = 500   # Should be one more than the last test to be run!
        testsToRun = testsNotToSkip + range(startAtTest, endAtTest)

        t = datetime.datetime.now()

        if 10 in testsToRun:
            # dt_to_datestr
            testName = 'Misc.dt_to_datestr()'
            self.SetStatusText(testName)
            prompt = 'Raw Date/Time information:  %s\n\n  Is the correct M/D/Y formatted date string "%s"?' % (t, Misc.dt_to_datestr(t))
            self.ConfirmTest(prompt, testName)

        if 20 in testsToRun:
            # time_in_ms_to_str
            testName = 'Misc.time_in_ms_to_str()'
            self.SetStatusText(testName)
            prompt = 'Are the following time to string conversions correct?\n\nTime in ms:\ttime_in_ms_to_str():\n'
            for x in [100, 200, 1000, 2000, 10000, 20000, 60000, 120000, 600000, 1200000, 3600000, 7200000]:
                prompt += "  %12d\t  %s\n" % (x, Misc.time_in_ms_to_str(x))
            self.ConfirmTest(prompt, testName)

        if 30 in testsToRun:
            # TimeMsToStr
            testName = 'Misc.TimeMsToStr()'
            self.SetStatusText(testName)
            prompt = 'Are the following time to string conversions correct?\n\nTime in ms:\tTimeMsToStr():\n'
            for x in [1000, 2000, 10000, 20000, 60000, 120000, 600000, 1200000, 3600000, 7200000]:
                prompt += "  %12d\t  %s\n" % (x, Misc.TimeMsToStr(x))
            self.ConfirmTest(prompt, testName)

        if 40 in testsToRun:
            # time_in_str_to_ms
            testName = 'Misc.time_in_str_to_ms()'
            self.SetStatusText(testName)
            prompt = 'Are the following string to time conversions correct?\n\nTime in string:\ttime_in_str_to_ms():\n'
            for x in ['0:00:00.1', '0:00:00.2', '0:00:01.0', '0:00:02.0', '0:00:10.0', '0:00:20.0', '0:01:00.0', '0:02:00.0', '0:10:00.0', '0:20:00.0', '1:00:00.0', '2:00:00.0']:
                prompt += "  %s\t  %12d\n" % (x, Misc.time_in_str_to_ms(x))
            self.ConfirmTest(prompt, testName)

        if 100 in testsToRun:
            # English
            testName = 'English translation'

            langName = 'en'
            lang = wx.LANGUAGE_ENGLISH
            self.presLan_en = gettext.translation('Transana', 'locale', languages=['en']) # English
            self.presLan_en.install()
            self.locale = wx.Locale(lang)
            self.locale.AddCatalog("Transana")
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)

        if 110 in testsToRun:
            # Arabic
            testName = 'Arabic translation'
            langName = 'ar'
            lang = wx.LANGUAGE_ARABIC
            self.presLan_ar = gettext.translation('Transana', 'locale', languages=['ar']) # Arabic
            self.presLan_ar.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)
            
        if 120 in testsToRun:
            # Danish
            testName = 'Danish translation'
            langName = 'da'
            lang = wx.LANGUAGE_DANISH
            self.presLan_da = gettext.translation('Transana', 'locale', languages=['da']) # Danish
            self.presLan_da.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)

        if 130 in testsToRun:
            # German
            testName = 'German translation'
            langName = 'de'
            lang = wx.LANGUAGE_GERMAN
            self.presLan_de = gettext.translation('Transana', 'locale', languages=['de']) # German
            self.presLan_de.install()
            self.locale = wx.Locale(lang)
            prompt  = '%s:  Series     = %s (%s)\n' % (langName, _('Series'),     type(_('Series')))
            prompt += '     Collection = %s (%s)\n' % (          _('Collection'), type(_('Collection')))
            prompt += '     Keyword    = %s (%s)\n' % (          _('Keyword'),    type(_('Keyword')))
            prompt += '     Search     = %s (%s)\n' % (          _('Search'),     type(_('Search')))
            self.ConfirmTest(prompt, testName)
#.........这里部分代码省略.........
开发者ID:satarsa,项目名称:Transana,代码行数:103,代码来源:unit_test_misc.py


注:本文中的Misc.dt_to_datestr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。