def testBases(self, LatLon): p = LatLon(50.06632, -5.71475) self.test('lat, lon', p, '50.06632°N, 005.71475°W') q = LatLon('50°03′59″N', """005°42'53"W""") self.test('lat, lon', q, '50.066389°N, 005.714722°W') p = LatLon(52.205, 0.119) q = LatLon(52.205, 0.119) self.test('isequalTo', p.isequalTo(q), True) t = precision(F_DMS, 0) p = LatLon(51.4778, -0.0016) self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W''') self.test('toStr', p.toStr(F_D), '51.4778°N, 000.0016°W') self.test('precision', precision(F_DMS), 0) p = LatLon(51.4778, -0.0016, 42) self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W, +42.00m''') precision(F_DMS, t) # restore q.latlon = p.latlon self.test('isequalTo', p.isequalTo(q), True) self.test('isequalTo3', p.isequalTo3(q), False) q.latlon = p.latlon + (p.height, ) self.test('isequalTo3', p.isequalTo3(q), True)
def testBases(self, module, LatLon): self.subtitle(module, LatLon.__name__) p = LatLon(50.06632, -5.71475) self.test('lat, lon', p, '50.06632°N, 005.71475°W') q = LatLon('50°03′59″N', """005°42'53"W""") self.test('lat, lon', q, '50.066389°N, 005.714722°W') p = LatLon(52.205, 0.119) q = p.copy() # LatLon(52.205, 0.119) self.test('isequalTo', q.isequalTo(p), True) self.test('isequalTo3', q.isequalTo3(p), True) self.test('latlon', q.latlon, p.latlon) self.test('latlonheight', q.latlonheight, p.latlonheight) self.test('phimlam', q.philam, p.philam) self.test('phimlamheight', q.philamheight, p.philamheight) t = precision(F_DMS, 0) p = LatLon(51.4778, -0.0016) self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W''') self.test('toStr', p.toStr(F_D), '51.4778°N, 000.0016°W') self.test('precision', precision(F_DMS), 0) p = LatLon(51.4778, -0.0016, 42) self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W, +42.00m''') precision(F_DMS, t) # restore q.latlon = p.latlon self.test('isequalTo', q.isequalTo(p), True) self.test('isequalTo3', q.isequalTo3(p), False) self.test('latlon', q.latlon, p.latlon) self.test('phimlam', q.philam, p.philam) q.latlon = p.latlon + (p.height, ) self.test('isequalTo', q.isequalTo(p), True) self.test('isequalTo3', q.isequalTo3(p), True) self.test('latlon', q.latlon, p.latlon) self.test('latlonheight', q.latlonheight, p.latlonheight) self.test('phimlam', q.philam, p.philam) self.test('phimlamheight', q.philamheight, p.philamheight) self.test('latlon', repr(q.latlon), repr(p.latlon)) self.test('latlonheight', repr(q.latlonheight), repr(p.latlonheight)) self.test('phimlam', repr(q.philam), repr(p.philam)) self.test('phimlamheight', repr(q.philamheight), repr(p.philamheight))
def testBases(self, LatLon): p = LatLon(50.06632, -5.71475) self.test('lat, lon', p, '50.06632°N, 005.71475°W') q = LatLon('50°03′59″N', """005°42'53"W""") self.test('lat, lon', q, '50.066389°N, 005.714722°W') p = LatLon(52.205, 0.119) q = LatLon(52.205, 0.119) self.test('equals', p.equals(q), 'True') p = LatLon(51.4778, -0.0016) precision(F_DMS, 0) self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W''') self.test('toStr', p.toStr(F_D), '51.4778°N, 000.0016°W') p = LatLon(51.4778, -0.0016, 42) self.test('precision', precision(F_DMS), '0') self.test('toStr', p.toStr(), '''51°28'40"N, 000°00'06"W, +42.00m''')