Exemple #1
0
def sort_all(lang):
    model_dir = os.path.join('progress', lang)
    model = Model()

    ff = model.all_files( model_dir )

    fname = ff[2]
    p = fname.split('.')
    fname1 = p[0] + '_s' + '.' + p[1]
    print fname
    print fname1
    model.load(fname)
    model.short_ignore = ['une', 'un']
    model.sort()
    model.save(fname1)
    def test_compare_lines(self):
        model = Model()
        model.short_ignore = ['une', 'un']

	line1 = Line('*un poste', {'category': 'basic'}, model)
	line2 = Line(u'une île = остров', {'category': 'basic'}, model)
	self.assertEqual(line1.text < line2.text, True)
	self.assertEqual(line_cmp(line1, line2), 1)

	line1 = Line('abc', {'category': 'basic'}, model)
	line2 = Line(u'def', {'category': 'basic'}, model)
	self.assertEqual(line1.text < line2.text, True)
	self.assertEqual(line_cmp(line1, line2), -1)

	line1 = Line('*une ville', {'category': 'basic'}, model)
	line2 = Line('artifice', {'category': 'basic'}, model)
	self.assertEqual(line1.text < line2.text, True)
	self.assertEqual(line_cmp(line1, line2), 1)

	line1 = Line('[Pl] lieu', {'category': 'basic'}, model)
	line2 = Line('artifice', {'category': 'basic'}, model)
	self.assertEqual(line1.text < line2.text, True)
	self.assertEqual(line_cmp(line1, line2), 1)