Esempio n. 1
0
 def test_handles_args_in_either_order(self):
     """ It shouldn't matter whether we pass the "higher" string as the first or second param. """
     low = "aaaaa"
     high = "zzzzz"
     mid1 = _mid_string(low, high)
     mid2 = _mid_string(low, high)
     self.assertEqual(mid1, mid2)
     self.assertTrue(low < mid1 < high)
Esempio n. 2
0
 def test_handles_args_in_either_order(self):
     """It shouldn't matter whether we pass the "higher" string as the first or second param."""
     low = "aaaaa"
     high = "zzzzz"
     mid1 = _mid_string(low, high)
     mid2 = _mid_string(low, high)
     self.assertEqual(mid1, mid2)
     self.assertTrue(low < mid1 < high)
Esempio n. 3
0
    def test_handles_strings_of_different_lengths(self):
        """ Strings of different lengths should return another of a length mid way between """
        start = "aaa"
        end = "zzzzzzzzzzzzz"
        mid = _mid_string(start, end)

        self.assertTrue(start < mid < end)
Esempio n. 4
0
 def test_slightly_less_basic_behaviour(self):
     start = "aaaaaaaaaaaa"
     end = "z"
     mid_low_apprx = "l"
     mid_high_apprx = "n"
     result = _mid_string(start, end)
     self.assertTrue(mid_low_apprx < result < mid_high_apprx)
Esempio n. 5
0
    def test_handles_strings_of_different_lengths(self):
        """ Strings of different lengths should return another of a length mid way between """
        start = "aaa"
        end = "zzzzzzzzzzzzz"
        mid = _mid_string(start, end)

        self.assertTrue(start < mid < end)
Esempio n. 6
0
 def test_slightly_less_basic_behaviour(self):
     start = "aaaaaaaaaaaa"
     end = "z"
     mid_low_apprx = "l"
     mid_high_apprx = "n"
     result = _mid_string(start, end)
     self.assertTrue(mid_low_apprx < result < mid_high_apprx)
Esempio n. 7
0
 def test_does_not_return_string_starting_with_double_underscore(self):
     """ A string that starts with a double underscore is not a valid Datastore key and so
         should not be returned.
     """
     # The true mid point between this start and end combination is a double underscore
     start = "^^"
     end = "``"
     result = _mid_string(start, end)
     self.assertNotEqual(result, "__")
Esempio n. 8
0
 def test_does_not_return_string_starting_with_double_underscore(self):
     """ A string that starts with a double underscore is not a valid Datastore key and so
         should not be returned.
     """
     # The true mid point between this start and end combination is a double underscore
     start = "^^"
     end = "``"
     result = _mid_string(start, end)
     self.assertNotEqual(result, "__")
Esempio n. 9
0
 def test_handles_unicode(self):
     """ It should be able to do comparisions on non-ascii strings. """
     start = u"aaa£¢$›😇"
     end = u"zzz🤡"
     mid = _mid_string(start, end)
     self.assertTrue(start < mid < end)
Esempio n. 10
0
 def test_basic_behaviour(self):
     """ Test finding the midpoint between two string in an obvious case. """
     start = "a"
     end = "c"
     self.assertEqual(_mid_string(start, end), "b")
Esempio n. 11
0
 def test_handles_unicode(self):
     """ It should be able to do comparisions on non-ascii strings. """
     start = u"aaa£¢$›😇"
     end = u"zzz🤡"
     mid = _mid_string(start, end)
     self.assertTrue(start < mid < end)
Esempio n. 12
0
 def test_basic_behaviour(self):
     """ Test finding the midpoint between two string in an obvious case. """
     start = "a"
     end = "c"
     self.assertEqual(_mid_string(start, end), "b")