Exemplo n.º 1
0
 def test_label_alt(self):
     ch = self._get_cnocke_heyst_nl()
     labels = [ch]
     self.assertEqual(ch, label(labels))
     self.assertEqual(ch, label(labels, 'nl-BE'))
     self.assertEqual(ch, label(labels, 'en'))
     self.assertEqual(ch, label(labels, None))
Exemplo n.º 2
0
 def testLabel(self):
     labels = self._get_labels()
     cs = ConceptScheme(uri='urn:x-skosprovider:gemeenten', labels=labels)
     self.assertEqual(label(labels), cs.label())
     self.assertEqual(label(labels, 'nl'), cs.label('nl'))
     self.assertEqual(label(labels, 'en'), cs.label('en'))
     self.assertEqual(label(labels, None), cs.label(None))
Exemplo n.º 3
0
 def test_label_pref(self):
     kh = self._get_knokke_heist_nl()
     labels = [kh]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 4
0
 def testLabel(self):
     labels = self._get_labels()
     coll = Collection(350, labels=labels)
     self.assertEqual(label(labels), coll.label())
     self.assertEqual(label(labels, 'nl'), coll.label('nl'))
     self.assertEqual(label(labels, 'en'), coll.label('en'))
     self.assertEqual(label(labels, None), coll.label(None))
Exemplo n.º 5
0
 def testLabel(self):
     labels = self._get_labels()
     c = Concept(1, labels=labels)
     self.assertEqual(label(labels), c.label())
     self.assertEqual(label(labels, 'nl'), c.label('nl'))
     self.assertEqual(label(labels, 'en'), c.label('en'))
     self.assertEqual(label(labels, None), c.label(None))
Exemplo n.º 6
0
 def testLabel(self):
     labels = self._get_labels()
     c = Concept(1, labels=labels)
     self.assertEqual(label(labels), c.label())
     self.assertEqual(label(labels, 'nl'), c.label('nl'))
     self.assertEqual(label(labels, 'en'), c.label('en'))
     self.assertEqual(label(labels, None), c.label(None))
Exemplo n.º 7
0
 def testLabel(self):
     labels = self._get_labels()
     coll = Collection(350, labels=labels)
     self.assertEqual(label(labels), coll.label())
     self.assertEqual(label(labels, 'nl'), coll.label('nl'))
     self.assertEqual(label(labels, 'en'), coll.label('en'))
     self.assertEqual(label(labels, None), coll.label(None))
Exemplo n.º 8
0
 def test_label_alt(self):
     ch = self._get_cnocke_heyst_nl()
     labels = [ch]
     self.assertEqual(ch, label(labels))
     self.assertEqual(ch, label(labels, 'nl-BE'))
     self.assertEqual(ch, label(labels, 'en-GB'))
     self.assertEqual(ch, label(labels, None))
Exemplo n.º 9
0
 def test_label_pref(self):
     kh = self._get_knokke_heist_nl()
     labels = [kh]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en-GB'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 10
0
 def test_filter_labels_by_language_unexisting(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     khen = self._get_knokke_heist_en()
     labels = [kh, ch, khen]
     assert label(labels, 'tomatensoep') is not None
     assert label(labels, '') is not None
Exemplo n.º 11
0
 def test_label_inexact_language_match(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     khen = self._get_knokke_heist_en()
     labels = [kh, ch, khen]
     assert khen == label(labels, 'en')
     assert kh == label(labels, 'nl')
     assert label(labels, None) in [kh, khen]
Exemplo n.º 12
0
 def test_dict_pref(self):
     kh = self._get_knokke_heist_nl()
     khd = kh.__dict__
     labels = [khd]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 13
0
 def test_label_pref_nl_and_en(self):
     kh = self._get_knokke_heist_nl()
     khen = self._get_knokke_heist_en()
     labels = [kh, khen]
     self.assertIn(label(labels), [kh, khen])
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(khen, label(labels, 'en'))
     self.assertIn(label(labels, None), [kh, khen])
Exemplo n.º 14
0
 def test_pref_precedes_alt(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     labels = [kh, ch]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en-GB'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 15
0
 def test_pref_precedes_alt(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     labels = [kh, ch]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 16
0
 def test_label_inexact_language_match(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     khen = self._get_knokke_heist_en()
     labels = [kh, ch, khen]
     assert khen == label(labels, 'en')
     assert kh == label(labels, 'nl')
     assert label(labels, None) in [kh, khen]
Exemplo n.º 17
0
 def test_dict_pref(self):
     kh = self._get_knokke_heist_nl()
     khd = kh.__dict__
     labels = [khd]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en-GB'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 18
0
 def test_label_pref_nl_and_en(self):
     kh = self._get_knokke_heist_nl()
     khen = self._get_knokke_heist_en()
     labels = [kh, khen]
     self.assertIn(label(labels), [kh, khen])
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(khen, label(labels, 'en-GB'))
     self.assertIn(label(labels, None), [kh, khen])
Exemplo n.º 19
0
 def test_sortlabel_unused(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     sl = self._get_sortlabel()
     labels = [kh, ch, sl]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, sortLabel=False))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en-GB'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 20
0
 def test_sortlabel_unused(self):
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     sl = self._get_sortlabel()
     labels = [kh, ch, sl]
     self.assertEqual(kh, label(labels))
     self.assertEqual(kh, label(labels, sortLabel=False))
     self.assertEqual(kh, label(labels, 'nl-BE'))
     self.assertEqual(kh, label(labels, 'en-GB'))
     self.assertEqual(kh, label(labels, None))
Exemplo n.º 21
0
 def testLabel(self):
     labels = self._get_labels()
     cs = ConceptScheme(
         uri='urn:x-skosprovider:gemeenten',
         labels=labels
     )
     self.assertEqual(label(labels), cs.label())
     self.assertEqual(label(labels, 'nl'), cs.label('nl'))
     self.assertEqual(label(labels, 'en'), cs.label('en'))
     self.assertEqual(label(labels, None), cs.label(None))
Exemplo n.º 22
0
 def test_sortlabel_broader(self):
     '''
     Test that a broader sortlabel gets picked up for a regional sort.
     '''
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     sl = Label('Eerst', type='sortLabel', language='nl')
     labels = [kh, ch, sl]
     assert sl == label(labels, 'nl-BE', True)
     assert sl == label(labels, ['nl-BE'], True)
Exemplo n.º 23
0
 def test_exact_precedes_inexact_match(self):
     khnl = Label('Knokke-Heist', type="prefLabel", language='nl')
     chnl = Label('Cnock-Heyst', type="altLabel", language='nl')
     khen = Label('Knocke-Heyst', type="prefLabel", language='en')
     khnlbe = self._get_knokke_heist_nl()
     chnlbe = self._get_cnocke_heyst_nl()
     khengb = self._get_knokke_heist_en()
     labels = [chnl, khen, khnlbe, khnl, chnlbe, khengb]
     assert khnlbe == label(labels, 'nl-BE')
     assert khnl == label(labels, 'nl')
     assert label(labels, 'en-US') in [khen, khengb]
Exemplo n.º 24
0
 def test_exact_precedes_inexact_match(self):
     khnl = Label('Knokke-Heist', type="prefLabel", language='nl')
     chnl = Label('Cnock-Heyst', type="altLabel", language='nl')
     khen = Label('Knocke-Heyst', type="prefLabel", language='en')
     khnlbe = self._get_knokke_heist_nl()
     chnlbe = self._get_cnocke_heyst_nl()
     khengb = self._get_knokke_heist_en()
     labels = [chnl, khen, khnlbe, khnl, chnlbe, khengb]
     assert khnlbe == label(labels, 'nl-BE')
     assert khnl == label(labels, 'nl')
     assert label(labels, 'en-US') in [khen, khengb]
Exemplo n.º 25
0
 def test_label_pref_und(self):
     und = self._get_und()
     labels = [und]
     assert label(labels) is not None
     self.assertEqual(und, label(labels))
     self.assertEqual(und, label(labels, 'nl-BE'))
     self.assertEqual(und, label(labels, ['nl-BE']))
     self.assertEqual(und, label(labels, 'en-GB'))
     self.assertEqual(und, label(labels, 'und'))
     self.assertEqual(und, label(labels, ['und']))
     self.assertEqual(und, label(labels, 'any'))
     self.assertEqual(und, label(labels, ['any']))
     self.assertEqual(und, label(labels, None))
Exemplo n.º 26
0
 def test_sortlabel_broader(self):
     '''
     Test that a broader sortlabel gets picked up for a regional sort.
     '''
     kh = self._get_knokke_heist_nl()
     ch = self._get_cnocke_heyst_nl()
     sl = Label('Eerst', type='sortLabel', language='nl')
     labels = [kh, ch, sl]
     assert sl == label(labels, 'nl-BE', True)
Exemplo n.º 27
0
 def test_label_pref_und(self):
     und = self._get_und()
     labels = [und]
     assert label(labels) is not None
     self.assertEqual(und, label(labels))
     self.assertEqual(und, label(labels, 'nl-BE'))
     self.assertEqual(und, label(labels, 'en-GB'))
     self.assertEqual(und, label(labels, 'und'))
     self.assertEqual(und, label(labels, 'any'))
     self.assertEqual(und, label(labels, None))
Exemplo n.º 28
0
 def test_label_empty(self):
     self.assertEqual(None, label([]))
     self.assertEqual(None, label([], 'nl-BE'))
     self.assertEqual(None, label([], None))
Exemplo n.º 29
0
 def test_label_empty(self):
     self.assertEqual(None, label([]))
     self.assertEqual(None, label([], 'nl-BE'))
     self.assertEqual(None, label([], None))
     self.assertEqual(None, label([], 'und'))