本文整理汇总了Python中flooding_lib.tools.importtool.test_models.InputFieldF.create方法的典型用法代码示例。如果您正苦于以下问题:Python InputFieldF.create方法的具体用法?Python InputFieldF.create怎么用?Python InputFieldF.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flooding_lib.tools.importtool.test_models.InputFieldF
的用法示例。
在下文中一共展示了InputFieldF.create方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_getitem
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def test_getitem(self):
name = u"dit is een input field"
InputFieldF.create(name=name)
header = eie.ImportedHeader()
foundfield = header.find_field_by_name(1, name)
self.assertTrue(header[1] is foundfield)
示例2: test_exception_if_occurs_twice
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def test_exception_if_occurs_twice(self):
name = "dit is een input field"
InputFieldF.create(name=name)
header = eie.ImportedHeader()
header.find_field_by_name(1, name)
self.assertRaises(eie.ImportedHeader.HeaderException, lambda: header.find_field_by_name(2, name))
示例3: setUp
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def setUp(self):
# Lots of setup
InputFieldF.create(name="Scenario Identificatie")
self.approvalobjecttype = testapprovalmodels.ApprovalObjectTypeF()
self.approvalrule = approvalmodels.ApprovalRule.objects.create(name="some rule", description="some description")
self.approvalobjecttype.approvalrule.add(self.approvalrule)
self.project = ProjectF.create(approval_object_type=self.approvalobjecttype)
self.scenario = ScenarioF.create(name="scenario name")
self.scenario.set_project(self.project)
示例4: test_can_iterate
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def test_can_iterate(self):
name = u"dit is een input field"
field = InputFieldF.create(name=name)
header = eie.ImportedHeader()
header.find_field_by_name(1, name)
for i, iterfield in enumerate(header):
self.assertEquals(i, 0) # We should only come here once
self.assertEquals(field, iterfield)
示例5: test_finds_field
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def test_finds_field(self):
name = u"dit is een input field"
field = InputFieldF.create(name=name)
fields = {}
header = eie.ImportedHeader(fields)
foundfield = header.find_field_by_name(1, name)
self.assertEquals(field, foundfield)
self.assertTrue(fields[1] is foundfield)
示例6: trivial_test
# 需要导入模块: from flooding_lib.tools.importtool.test_models import InputFieldF [as 别名]
# 或者: from flooding_lib.tools.importtool.test_models.InputFieldF import create [as 别名]
def trivial_test(self):
inputfield = InputFieldF.create()
mock_result = mock.MagicMock()
mock_result.scenario.value_for_inputfield.return_value = 100.0 / 24
grid = numpy.array([-999, 0, 50, 150])
# -999 must be untouched
# 0 and are too low, untouched
# 100 should be subtracted from 150
with mock.patch(
'flooding_lib.tasks.'
'png_generation.INPUTFIELD_STARTMOMENT_BREACHGROWTH_ID',
new=inputfield.id):
png_generation.correct_gridta(grid, mock_result)
self.assertTrue((grid == numpy.array([-999, 0, 50, 50])).all())