コード例 #1
0
    def test_area_auto(self):
        # Line
        interv = InfrastructureInterventionFactory.create(width=10.0)
        interv.reload()
        self.assertEqual(interv.area, interv.length * 10.0)

        # Points
        interv = InfrastructurePointInterventionFactory.create()
        interv.reload()
        self.assertEqual(interv.length, 0.0)
        self.assertEqual(interv.area, 0.0)

        interv = InfrastructurePointInterventionFactory.create(length=50,
                                                               width=10.0)
        interv.reload()
        self.assertEqual(interv.area, 500)

        interv = InfrastructurePointInterventionFactory.create(width=0.5,
                                                               length=0.5)
        interv.reload()
        self.assertEqual(interv.area, 0.25)

        interv = InfrastructurePointInterventionFactory.create(width=0.5)
        interv.reload()
        self.assertEqual(interv.area, 0.0)
コード例 #2
0
 def test_length_not_auto_nds(self):
     interv = InfrastructureInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertEqual(interv.length, 3.14)
     # Point intervention has manual length
     interv = InfrastructurePointInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertEqual(interv.length, 3.14)
コード例 #3
0
 def test_length_auto(self):
     # Line intervention has auto length from topology
     interv = InfrastructureInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertNotEqual(interv.length, 3.14)
     # Point intervention has manual length
     interv = InfrastructurePointInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertEqual(interv.length, 3.14)
コード例 #4
0
ファイル: intervention.py プロジェクト: Web5design/Geotrek
 def test_length_auto(self):
     # Line intervention has auto length from topology
     interv = InfrastructureInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertNotEqual(interv.length, 3.14)
     # Point intervention has manual length
     interv = InfrastructurePointInterventionFactory.create()
     interv.length = 3.14
     interv.save()
     self.assertEqual(interv.length, 3.14)
コード例 #5
0
ファイル: intervention.py プロジェクト: Web5design/Geotrek
    def test_area_auto(self):
        # Line
        interv = InfrastructureInterventionFactory.create(width=10.0)
        interv.reload()
        self.assertEqual(interv.area, interv.length * 10.0)

        # Points
        interv = InfrastructurePointInterventionFactory.create()
        interv.reload()
        self.assertEqual(interv.length, 0.0)
        self.assertEqual(interv.area, 0.0)

        interv = InfrastructurePointInterventionFactory.create(length=50, width=10.0)
        interv.reload()
        self.assertEqual(interv.area, 500)

        interv = InfrastructurePointInterventionFactory.create(width=0.5, length=0.5)
        interv.reload()
        self.assertEqual(interv.area, 0.25)

        interv = InfrastructurePointInterventionFactory.create(width=0.5)
        interv.reload()
        self.assertEqual(interv.area, 0.0)