本文整理汇总了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)
示例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 )
示例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)
示例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' )
示例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")
示例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 )
示例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>",
)
示例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 )
示例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)
示例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>" )