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


Python Resource.lastmod方法代码示例

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


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

示例1: test1c_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test1c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource("a")
     r1lm = "2012-01-01T00:00:00Z"
     r1.lastmod = r1lm
     r2 = Resource("a")
     for r2lm in (
         "2012",
         "2012-01",
         "2012-01-01",
         "2012-01-01T00:00Z",
         "2012-01-01T00:00:00Z",
         "2012-01-01T00:00:00.000000Z",
         "2012-01-01T00:00:00.000000000000Z",
         "2012-01-01T00:00:00.000000000001Z",  # below resolution
         "2012-01-01T00:00:00.00+00:00",
         "2012-01-01T00:00:00.00-00:00",
         "2012-01-01T02:00:00.00-02:00",
         "2011-12-31T23:00:00.00+01:00",
     ):
         r2.lastmod = r2lm
         self.assertEqual(
             r1.timestamp, r2.timestamp, ("%s (%f) == %s (%f)" % (r1lm, r1.timestamp, r2lm, r2.timestamp))
         )
         self.assertEqual(r1, r2)
开发者ID:pedak,项目名称:sync-oai,代码行数:27,代码来源:test_resource.py

示例2: test01d_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test01d_same(self):
     """Same with slight timestamp diff"""
     r1 = Resource('a')
     r1.lastmod='2012-01-02T01:02:03Z'
     r2 = Resource('a')
     r2.lastmod='2012-01-02T01:02:03.99Z'
     self.assertNotEqual( r1.timestamp, r2.timestamp )
     self.assertEqual( r1, r2 )
开发者ID:EHRI,项目名称:resync,代码行数:10,代码来源:test_resource.py

示例3: test1d_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test1d_same(self):
     """Same with slight timestamp diff"""
     r1 = Resource("a")
     r1.lastmod = "2012-01-02T01:02:03Z"
     r2 = Resource("a")
     r2.lastmod = "2012-01-02T01:02:03.99Z"
     self.assertNotEqual(r1.timestamp, r2.timestamp)
     self.assertEqual(r1, r2)
开发者ID:pedak,项目名称:sync-oai,代码行数:10,代码来源:test_resource.py

示例4: test05_lastmod_roundtrips

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test05_lastmod_roundtrips(self):
     r = Resource('a')
     r.lastmod='2012-03-14'
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T00:00:00+00:00'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T00:00:00-00:00'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T00:00:00Z' )
     r.lastmod='2012-03-14T18:37:36Z'
     #print r.timestamp
     self.assertEqual( r.lastmod, '2012-03-14T18:37:36Z' )
开发者ID:EHRI,项目名称:resync,代码行数:15,代码来源:test_resource.py

示例5: test5_lastmod_roundtrips

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test5_lastmod_roundtrips(self):
     r = Resource("a")
     r.lastmod = "2012-03-14"
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T00:00:00+00:00"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T00:00:00-00:00"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T00:00:00Z")
     r.lastmod = "2012-03-14T18:37:36Z"
     print r.timestamp
     self.assertEqual(r.lastmod, "2012-03-14T18:37:36Z")
开发者ID:pedak,项目名称:sync-oai,代码行数:15,代码来源:test_resource.py

示例6: test1c_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test1c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource('a')
     r1.lastmod='2012-01-02'
     r2 = Resource('a')
     r2.lastmod='2012-01-02T00:00:00'
     r3 = Resource('a')
     r3.lastmod='2012-01-02T00:00:00.00'
     self.assertEqual( r1.timestamp, r2.timestamp )
     self.assertEqual( r1.timestamp, r3.timestamp )
     self.assertEqual( r1, r1 )
     self.assertEqual( r1, r2 )
     self.assertEqual( r1, r3 )
开发者ID:edsu,项目名称:resync-simulator,代码行数:15,代码来源:test_resource.py

示例7: test_01_resource_str

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test_01_resource_str(self):
     r1 = Resource("a3")
     r1.lastmod = "2012-01-11T01:02:03"
     self.assertEqual(
         Sitemap().resource_as_xml(r1),
         "<?xml version='1.0' encoding='UTF-8'?>\n<url><loc>a3</loc><lastmod>2012-01-11T01:02:03</lastmod></url>",
     )
开发者ID:pedak,项目名称:resdbp,代码行数:9,代码来源:test_sitemap.py

示例8: test01c_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test01c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource('a')
     r1lm = '2012-01-01T00:00:00Z'
     r1.lastmod = r1lm
     r2 = Resource('a')
     for r2lm in ('2012',
                  '2012-01',
                  '2012-01-01',
                  '2012-01-01T00:00Z',
                  '2012-01-01T00:00:00Z',
                  '2012-01-01T00:00:00.000000Z',
                  '2012-01-01T00:00:00.000000000000Z',
                  '2012-01-01T00:00:00.000000000001Z', #below resolution
                  '2012-01-01T00:00:00.00+00:00',
                  '2012-01-01T00:00:00.00-00:00',
                  '2012-01-01T02:00:00.00-02:00',
                  '2011-12-31T23:00:00.00+01:00'
                  ):
         r2.lastmod = r2lm
         self.assertEqual( r1.timestamp, r2.timestamp, ('%s (%f) == %s (%f)' % (r1lm,r1.timestamp,r2lm,r2.timestamp)) )
         self.assertEqual( r1, r2 )
开发者ID:EHRI,项目名称:resync,代码行数:24,代码来源:test_resource.py

示例9: test1c_same

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test1c_same(self):
     """Same with lastmod instead of direct timestamp"""
     r1 = Resource("a")
     r1.lastmod = "2012-01-02"
     r2 = Resource("a")
     for r2lm in (
         "2012-01-02",
         "2012-01-02T00:00",
         "2012-01-02T00:00:00",
         "2012-01-02 00:00:00",
         "2012-01-02T00:00:00.00",
         "2012-01-02T00:00:00.000000000000",
         "2012-01-02T00:00:00.000000000001",  # below resolution
         "2012-01-02T00:00:00.00Z",
         "2012-01-02T00:00:00.00+0000",
         "2012-01-02T00:00:00.00-0000",
         "2012-01-02T00:00:00.00+00:00",
         "2012-01-02T00:00:00.00-00:00",
         "2012-01-02T00:00:00.00+02:00",  # FIXME - TZ info currently ignored
     ):
         r2.lastmod = r2lm
         self.assertEqual(r1.timestamp, r2.timestamp)
         self.assertEqual(r1.timestamp, r2.timestamp, ("2012-01-02 == %s" % r2lm))
         self.assertEqual(r1, r2)
开发者ID:pedak,项目名称:resdbp,代码行数:26,代码来源:test_resource.py

示例10: test_01_resource_str

# 需要导入模块: from resync.resource import Resource [as 别名]
# 或者: from resync.resource.Resource import lastmod [as 别名]
 def test_01_resource_str(self):
     r1 = Resource('a3')
     r1.lastmod='2012-01-11T01:02:03Z'
     self.assertEqual( Sitemap().resource_as_xml(r1), "<url><loc>a3</loc><lastmod>2012-01-11T01:02:03Z</lastmod></url>" )
开发者ID:,项目名称:,代码行数:6,代码来源:


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