def test_adjacent(self):
    cell = geocell.compute(geotypes.Point(37, -122), 14)
    box = geocell.compute_box(cell)

    # adjacency tests using bounding boxes
    self.assertEquals(box.north,
        geocell.compute_box(geocell.adjacent(cell, (0, 1))).south)
    self.assertEquals(box.south,
        geocell.compute_box(geocell.adjacent(cell, (0, -1))).north)
    self.assertEquals(box.east,
        geocell.compute_box(geocell.adjacent(cell, (1, 0))).west)
    self.assertEquals(box.west,
        geocell.compute_box(geocell.adjacent(cell, (-1, 0))).east)

    self.assertEquals(8, len(geocell.all_adjacents(cell)))

    # also test collinearity
    self.assertTrue(
        geocell.collinear(cell, geocell.adjacent(cell, (0, 1)), True))
    self.assertFalse(
        geocell.collinear(cell, geocell.adjacent(cell, (0, 1)), False))
    self.assertTrue(
        geocell.collinear(cell, geocell.adjacent(cell, (1, 0)), False))
    self.assertFalse(
        geocell.collinear(cell, geocell.adjacent(cell, (1, 0)), True))
Exemple #2
0
  def test_adjacent(self):
    cell = geocell.compute(geotypes.Point(37, -122), 14)
    box = geocell.compute_box(cell)

    # adjacency tests using bounding boxes
    self.assertEquals(box.north,
        geocell.compute_box(geocell.adjacent(cell, (0, 1))).south)
    self.assertEquals(box.south,
        geocell.compute_box(geocell.adjacent(cell, (0, -1))).north)
    self.assertEquals(box.east,
        geocell.compute_box(geocell.adjacent(cell, (1, 0))).west)
    self.assertEquals(box.west,
        geocell.compute_box(geocell.adjacent(cell, (-1, 0))).east)

    self.assertEquals(8, len(geocell.all_adjacents(cell)))

    # also test collinearity
    self.assertTrue(
        geocell.collinear(cell, geocell.adjacent(cell, (0, 1)), True))
    self.assertFalse(
        geocell.collinear(cell, geocell.adjacent(cell, (0, 1)), False))
    self.assertTrue(
        geocell.collinear(cell, geocell.adjacent(cell, (1, 0)), False))
    self.assertFalse(
        geocell.collinear(cell, geocell.adjacent(cell, (1, 0)), True))
  def test_compute_box(self):
    cell = geocell.compute(geotypes.Point(37, -122), 14)
    box = geocell.compute_box(cell)

    self.assertTrue(box.south <= 37 and 37 <= box.north and
                    box.west <= -122 and -122 <= box.east)
import webapp2
Exemple #5
0
import webapp2
Exemple #6
0
  def test_compute_box(self):
    cell = geocell.compute(geotypes.Point(37, -122), 14)
    box = geocell.compute_box(cell)

    self.assertTrue(box.south <= 37 and 37 <= box.north and
                    box.west <= -122 and -122 <= box.east)