示例#1
0
    def test_collation_order(self):
        'Testing collation ordering'
        for group in [
            (self.ae, ('Šaa', 'Smith', 'Solženicyn', 'Štepánek')),
            (self.ae, ('11', '011')),
            (self.ane, ('2', '1')),
            (self.ae, ('100 Smith', '0100 Smith')),
        ]:
            last = None
            assert_func = group[0]
            for x in group[1]:
                order, _ = icu.numeric_collator().collation_order(x)
                if last is not None:
                    assert_func(
                        last, order,
                        f'Order for {x} not correct: {last} != {order}')
                last = order

        self.ae(
            dict(
                icu.partition_by_first_letter(
                    ['A1', '', 'a1', '\U0001f431', '\U0001f431x'])), {
                        ' ': [''],
                        'A': ['A1', 'a1'],
                        '\U0001f431': ['\U0001f431', '\U0001f431x']
                    })
示例#2
0
 def test_collation_order(self):
     'Testing collation ordering'
     for group in [
         ('Šaa', 'Smith', 'Solženicyn', 'Štepánek'),
         ('01', '1'),
         ('1', '11', '13'),
     ]:
         last = None
         for x in group:
             order, length = icu.numeric_collator().collation_order(x)
             if last is not None:
                 self.ae(last, order)
             last = order
示例#3
0
    def test_collation_order(self):
        "Testing collation ordering"
        for group in [("Šaa", "Smith", "Solženicyn", "Štepánek"), ("01", "1"), ("1", "11", "13")]:
            last = None
            for x in group:
                order, length = icu.numeric_collator().collation_order(x)
                if last is not None:
                    self.ae(last, order)
                last = order

        self.ae(
            dict(icu.partition_by_first_letter(["A1", "", "a1", "\U0001f431", "\U0001f431x"])),
            {" ": [""], "A": ["A1", "a1"], "\U0001f431": ["\U0001f431", "\U0001f431x"]},
        )
示例#4
0
    def test_collation_order(self):
        'Testing collation ordering'
        for group in [
            ('Šaa', 'Smith', 'Solženicyn', 'Štepánek'),
            ('01', '1'),
        ]:
            last = None
            for x in group:
                order, length = icu.numeric_collator().collation_order(x)
                if last is not None:
                    self.ae(last, order, 'Order for %s not correct: %s != %s' % (x, last, order))
                last = order

        self.ae(dict(icu.partition_by_first_letter(['A1', '', 'a1', '\U0001f431', '\U0001f431x'])),
                {' ':[''], 'A':['A1', 'a1'], '\U0001f431':['\U0001f431', '\U0001f431x']})
示例#5
0
    def test_collation_order(self):
        'Testing collation ordering'
        for group in [
            ('Šaa', 'Smith', 'Solženicyn', 'Štepánek'),
            ('01', '1'),
        ]:
            last = None
            for x in group:
                order, length = icu.numeric_collator().collation_order(x)
                if last is not None:
                    self.ae(last, order, 'Order for %s not correct: %s != %s' % (x, last, order))
                last = order

        self.ae(dict(icu.partition_by_first_letter(['A1', '', 'a1', '\U0001f431', '\U0001f431x'])),
                {' ':[''], 'A':['A1', 'a1'], '\U0001f431':['\U0001f431', '\U0001f431x']})