@@ -613,6 +613,33 @@ def testS2EarthMetricRadians(self):
613613 radius_m = s2 .S2Earth .RadiansToMeters (angle .radians ())
614614 self .assertEqual (radius_m , 12340.0 )
615615
616+ def testRepr (self ):
617+ ll_null = s2 .S2LatLng ()
618+ self .assertEqual (repr (ll_null ), "<S2LatLng: (0.000000,0.000000)>" )
619+
620+ lon1 = s2 .S2LatLng .FromDegrees (51.3368602 , 0.4931979 )
621+ self .assertEqual (repr (lon1 ), "<S2LatLng: (51.336860,0.493198)>" )
622+
623+ london = s2 .S2LatLngRect (lon1 ,
624+ s2 .S2LatLng .FromDegrees (51.7323965 , 0.1495211 ))
625+ self .assertEqual (repr (london ),
626+ "<S2LatLngRect: (51.3368602,0.4931979,51.7323965,0.1495211)>"
627+ )
628+
629+ llr_null = s2 .S2LatLngRect ()
630+ self .assertEqual (repr (llr_null ),
631+ "<S2LatLngRect: Empty>"
632+ )
633+
634+ cell_id = s2 .S2CellId .FromToken ("487604c489f841c3" )
635+ self .assertEqual (repr (cell_id ), "<S2CellId: 2/100323000212021010333002003201>" )
636+
637+ cell = s2 .S2Cell (cell_id )
638+ self .assertEqual (repr (cell ), "<S2Cell: 2/100323000212021010333002003201>" )
639+
640+ cell_id = s2 .S2CellId .FromToken ("this is invalid" )
641+ self .assertEqual (repr (cell_id ), "<S2CellId: Invalid: 0000000000000000>" )
642+
616643
617644class RegionTermIndexerTest (unittest .TestCase ):
618645 def _randomCaps (self , query_type , ** indexer_options ):
0 commit comments