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


Python Task.frequency方法代码示例

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


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

示例1: test_tasks

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_tasks(self):
     s = Supplier()
     s.name = 'Joe'
     s.save()
     
     p = Property()
     p.save()
     l = Location(property = p)
     l.save()
     a = Asset(location = l)
     a.save()         
     t = Task(asset = a)
     t.name = 'Mop floors'
     t.frequency = 1
     t.save()
      
     q = Quote(supplier = s)
     q.amount = 4
     q.save()
     
     self.assertEqual(0, len(q.tasks.all()))
     
     q.tasks.add(t)
     self.assertEqual(1, len(q.tasks.all()))
       
     self.assertEqual
     self.assertEqual("$4.00 to Mop floors (Joe)", str(q))
开发者ID:ianfp,项目名称:property,代码行数:29,代码来源:models.py

示例2: test_frequency_object

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_frequency_object(self):
     """
     Ensure that the .frequency setter works with Frequency objects, too.
     """
     t = Task()
     for value in [0, 1, 6, 12]:
         t.frequency = Frequency(value)
         self.assertEqual(value, t._frequency)
开发者ID:ianfp,项目名称:property,代码行数:10,代码来源:models.py

示例3: test_frequency

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_frequency(self):
     t = Task()
     tests = {
          0: "once",
          1: "every month",
          2: "every 2 months",
          12: "every year",
          13: "every 13 months",
          24: "every 2 years"
     }
     
     for value, expected in tests.items():
         t.frequency = value
         self.assertEqual(expected, str(t.frequency))
开发者ID:ianfp,项目名称:property,代码行数:16,代码来源:models.py

示例4: _create_task

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
def _create_task(row, asset):
    if row['task'] == '':
        return None
    try:
        task = Task.objects.get(
            asset__pk=asset.pk,
            name__iexact=row['task'])
    except Task.DoesNotExist:
        task = Task(name=row['task'], asset=asset)
    task.frequency = Frequency.parse(row['frequency'])
    task.last_done = _parse_last_done(row['last done'])
    task.priority = Priority.parse(row['priority'])
    if row['estimate'] != '':
        task.estimate = float(row['estimate'])
    task.save()
    return task
开发者ID:ianfp,项目名称:property,代码行数:18,代码来源:services.py

示例5: test_next_due_zero

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_next_due_zero(self):
     t = Task()
     t.last_done = date(2012, 1, 1)
     t.frequency = 0
     
     self.assertIsNone(t.next_due)
开发者ID:ianfp,项目名称:property,代码行数:8,代码来源:models.py

示例6: test_next_due_null

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_next_due_null(self):
     t = Task()
     t.last_done = None
     t.frequency = 1
     
     self.assertIsNone(t.next_due)
开发者ID:ianfp,项目名称:property,代码行数:8,代码来源:models.py

示例7: test_next_due

# 需要导入模块: from tasks.models import Task [as 别名]
# 或者: from tasks.models.Task import frequency [as 别名]
 def test_next_due(self):
     t = Task()
     t.last_done = date(2012, 1, 1)
     t.frequency = 1
     
     self.assertEqual(date(2012, 2, 1), t.next_due)
开发者ID:ianfp,项目名称:property,代码行数:8,代码来源:models.py


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