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)
Esempio n. 2
0
    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)
    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))
Esempio n. 4
0
    def test_exception_if_occurs_twice(self):
        name = u"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))
    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)
Esempio n. 6
0
    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)
Esempio n. 7
0
    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)
    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)
Esempio n. 9
0
    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)
    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)
    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())