Ejemplo n.º 1
0
 def test_one(self):
     tilestore = DictTileStore()
     self.assertEqual(len(tilestore), 0)
     tilestream = [Tile(TileCoord(1, 0, 0), data='data'), None, Tile(TileCoord(1, 0, 1), error=True)]
     tilestream = tilestore.put(tilestream)
     tiles = list(tilestream)
     self.assertEqual(len(tiles), 2)
     self.assertEqual(tiles[0].tilecoord, TileCoord(1, 0, 0))
     self.assertEqual(tiles[0].data, 'data')
     self.assertEqual(tiles[1].tilecoord, TileCoord(1, 0, 1))
     self.assertEqual(tiles[1].error, True)
     self.assertTrue(Tile(TileCoord(1, 0, 0)) in tilestore)
     self.assertTrue(Tile(TileCoord(1, 0, 1)) in tilestore)
     tilestream = [Tile(TileCoord(1, 0, 0)), Tile(TileCoord(1, 0, 1))]
     tilestream = tilestore.get(tilestream)
     consume(tilestream, None)
     tiles = list(tilestore.get_all())
     self.assertEqual(len(tiles), 2)
     self.assertEqual(tiles[0].tilecoord, TileCoord(1, 0, 0))
     self.assertEqual(tiles[0].data, 'data')
     self.assertEqual(tiles[1].tilecoord, TileCoord(1, 0, 1))
     self.assertEqual(tiles[1].error, True)
     tilestream = [Tile(TileCoord(1, 0, 0))]
     tilestream = tilestore.delete(tilestream)
     consume(tilestream, None)
     tiles = list(tilestore.get_all())
     self.assertEqual(len(tiles), 1)
     self.assertFalse(Tile(TileCoord(1, 0, 0)) in tilestore)
     self.assertTrue(Tile(TileCoord(1, 0, 1)) in tilestore)
Ejemplo n.º 2
0
 def test_one(self):
     tilestore = DictTileStore()
     self.assertEqual(len(tilestore), 0)
     tilestream = [
         Tile(TileCoord(1, 0, 0), data='data'), None,
         Tile(TileCoord(1, 0, 1), error=True)
     ]
     tilestream = tilestore.put(tilestream)
     tiles = list(tilestream)
     self.assertEqual(len(tiles), 2)
     self.assertEqual(tiles[0].tilecoord, TileCoord(1, 0, 0))
     self.assertEqual(tiles[0].data, 'data')
     self.assertEqual(tiles[1].tilecoord, TileCoord(1, 0, 1))
     self.assertEqual(tiles[1].error, True)
     self.assertTrue(Tile(TileCoord(1, 0, 0)) in tilestore)
     self.assertTrue(Tile(TileCoord(1, 0, 1)) in tilestore)
     tilestream = [Tile(TileCoord(1, 0, 0)), Tile(TileCoord(1, 0, 1))]
     tilestream = tilestore.get(tilestream)
     consume(tilestream, None)
     tiles = list(tilestore.get_all())
     self.assertEqual(len(tiles), 2)
     self.assertEqual(tiles[0].tilecoord, TileCoord(1, 0, 0))
     self.assertEqual(tiles[0].data, 'data')
     self.assertEqual(tiles[1].tilecoord, TileCoord(1, 0, 1))
     self.assertEqual(tiles[1].error, True)
     tilestream = [Tile(TileCoord(1, 0, 0))]
     tilestream = tilestore.delete(tilestream)
     consume(tilestream, None)
     tiles = list(tilestore.get_all())
     self.assertEqual(len(tiles), 1)
     self.assertFalse(Tile(TileCoord(1, 0, 0)) in tilestore)
     self.assertTrue(Tile(TileCoord(1, 0, 1)) in tilestore)