def test_string_range(self): """ Given 2 string-based keys, it should return a representation of the range that the two keys span. """ key1 = datastore.Key.from_path("my_kind", "a") key2 = datastore.Key.from_path("my_kind", "b") # The difference between "a" and "b" is 1 character self.assertEqual(_get_range(key1, key2), 1)
def test_string_range(self): """ Given 2 string-based keys, it should return a representation of the range that the two keys span. """ key1 = datastore.Key.from_path("my_kind", "a") key2 = datastore.Key.from_path("my_kind", "b") # The difference between "a" and "b" is 1 character self.assertEqual(_get_range(key1, key2), unichr(1))
def test_long_string_keys_with(self): key1 = datastore.Key.from_path('my_kind', '60a1fef9136a4584a1cbf8a3193394b6') key2 = datastore.Key.from_path('my_kind', '5e840832631344adb297493a5aade1bc') value = _get_range(key1, key2) self.assertTrue(value > 0)
def test_integer_range(self): """ Given 2 integer-based keys, it should return the range that the IDs span. """ key1 = datastore.Key.from_path("my_kind", 4012809128) key2 = datastore.Key.from_path("my_kind", 9524773032) self.assertEqual(_get_range(key1, key2), 9524773032 - 4012809128)