Exemple #1
0
 def test_withInvariant(self):
     """
     Creating a simple L{base.PositionError} with just a HDOP while
     checking the invariant works.
     """
     positionError = base.PositionError(hdop=1.0, testInvariant=True)
     self.assertEqual(positionError.hdop, 1.0)
Exemple #2
0
 def test_horizontalAndVerticalSet(self):
     """
     The PDOP is correctly determined from HDOP and VDOP.
     """
     hdop, vdop = 1.0, 1.0
     pdop = (hdop**2 + vdop**2)**.5
     pe = base.PositionError(hdop=hdop, vdop=vdop)
     self._testDOP(pe, pdop, hdop, vdop)
Exemple #3
0
 def test_positionAndVerticalSet(self):
     """
     The HDOP is correctly determined from PDOP and VDOP.
     """
     pdop, vdop = 2.0, 1.0
     hdop = (pdop**2 - vdop**2)**.5
     pe = base.PositionError(pdop=pdop, vdop=vdop)
     self._testDOP(pe, pdop, hdop, vdop)
Exemple #4
0
 def test_positionAndHorizontalSet(self):
     """
     The VDOP is correctly determined from PDOP and HDOP.
     """
     pdop, hdop = 2.0, 1.0
     vdop = (pdop**2 - hdop**2)**.5
     pe = base.PositionError(pdop=pdop, hdop=hdop)
     self._testDOP(pe, pdop, hdop, vdop)
Exemple #5
0
 def test_setDOPWithoutInvariant(self):
     """
     You can set the PDOP value to value inconsisted with HDOP and VDOP
     when not checking the invariant.
     """
     pe = base.PositionError(hdop=1.0, vdop=1.0)
     pe.pdop = 100.0
     self.assertEqual(pe.pdop, 100.0)
Exemple #6
0
 def test_invalidWithoutInvariant(self):
     """
     Creating a L{base.PositionError} with values set to an impossible
     combination works if the invariant is not checked.
     """
     error = base.PositionError(pdop=1.0, vdop=1.0, hdop=1.0)
     self.assertEqual(error.pdop, 1.0)
     self.assertEqual(error.hdop, 1.0)
     self.assertEqual(error.vdop, 1.0)
Exemple #7
0
 def test_allUnsetWithInvariant(self):
     """
     In an empty L{base.PositionError} with invariant testing, all
     dilutions of positions are C{None}.
     """
     positionError = base.PositionError(testInvariant=True)
     self.assertEqual(positionError.pdop, None)
     self.assertEqual(positionError.hdop, None)
     self.assertEqual(positionError.vdop, None)
Exemple #8
0
 def test_mixing(self):
     pdop, hdop, vdop = "1", "1", "1"
     positionError = base.PositionError(pdop=float(pdop),
                                        hdop=float(hdop),
                                        vdop=float(vdop))
     sentenceData = {'positionDilutionOfPrecision': pdop,
                     'horizontalDilutionOfPrecision': hdop,
                     'verticalDilutionOfPrecision': vdop}
     self._fixerTest(sentenceData, {"positionError": positionError})
Exemple #9
0
 def test_allUnset(self):
     """
     In an empty L{base.PositionError} with no invariant testing, all
     dilutions of positions are L{None}.
     """
     positionError = base.PositionError()
     self.assertIsNone(positionError.pdop)
     self.assertIsNone(positionError.hdop)
     self.assertIsNone(positionError.vdop)
Exemple #10
0
    def test_setDOPWithInvariant(self):
        """
        Attempting to set the PDOP value to value inconsisted with HDOP and
        VDOP when checking the invariant raises C{ValueError}.
        """
        pe = base.PositionError(hdop=1.0, vdop=1.0, testInvariant=True)
        pdop = pe.pdop

        def setPDOP(pe):
            pe.pdop = 100.0

        self.assertRaises(ValueError, setPDOP, pe)
        self.assertEqual(pe.pdop, pdop)
Exemple #11
0
 def test_simple(self):
     self._fixerTest(
         {"horizontalDilutionOfPrecision": "11"},
         {"positionError": base.PositionError(hdop=11.0)},
     )
Exemple #12
0
 def test_withoutInvariant(self):
     """
     L{base.PositionError}s can be instantiated with just a HDOP.
     """
     positionError = base.PositionError(hdop=1.0)
     self.assertEqual(positionError.hdop, 1.0)
Exemple #13
0
 def test_simple(self):
     self._fixerTest(
         {'horizontalDilutionOfPrecision': '11'},
         {'positionError': base.PositionError(hdop=11.)})