def test_above_first_res(self): grid = TileGrid(res=[1000, 500, 250, 100, 50], threshold_res=[1100, 750]) grid.stretch_factor = 1.1 eq_(grid.closest_level(1200), 0) eq_(grid.closest_level(1100), 0) eq_(grid.closest_level(1000), 0) eq_(grid.closest_level(800), 0) eq_(grid.closest_level(750.1), 0) eq_(grid.closest_level(750), 1)
def test_upper_bound(self): # thresholds near the next upper res value (within threshold) grid = TileGrid(res=[1000, 500, 250, 100, 50], threshold_res=[495, 240]) grid.stretch_factor = 1.1 eq_(grid.closest_level(1100), 0) # regular transition (w/stretchfactor) eq_(grid.closest_level(950), 0) eq_(grid.closest_level(800), 1) eq_(grid.closest_level(500), 1) # transition at threshold eq_(grid.closest_level(496), 1) eq_(grid.closest_level(495), 2) eq_(grid.closest_level(250), 2) # transition at threshold (within strechfactor) eq_(grid.closest_level(241), 2) eq_(grid.closest_level(240), 3) eq_(grid.closest_level(100), 3) # regular transition (w/stretchfactor) eq_(grid.closest_level(92), 3) eq_(grid.closest_level(90), 4)
def test_lower_bound(self): # thresholds near the next lower res value grid = TileGrid(res=[1000, 500, 250, 100, 50], threshold_res=[300, 110]) grid.stretch_factor = 1.1 eq_(grid.closest_level(1100), 0) # regular transition (w/stretchfactor) eq_(grid.closest_level(950), 0) eq_(grid.closest_level(800), 1) eq_(grid.closest_level(500), 1) # transition at threshold eq_(grid.closest_level(301), 1) eq_(grid.closest_level(300), 2) eq_(grid.closest_level(250), 2) # transition at threshold eq_(grid.closest_level(111), 2) eq_(grid.closest_level(110), 3) eq_(grid.closest_level(100), 3) # regular transition (w/stretchfactor) eq_(grid.closest_level(92), 3) eq_(grid.closest_level(90), 4)