Redaktor:Atomobot/test atomobot language.py
#!/usr/bin/python2.4 # -*- coding: utf-8 -*- import unittest from atomobot_language import AtomobotLanguageSlovak class AtomobotLanguageSlovakTestCase( unittest.TestCase ): def testInit( self ): lang = AtomobotLanguageSlovak() def testBasics1( self ): lang = AtomobotLanguageSlovak() a = lang.letters_by_first[ 'C' ] self.assertEquals( a, [ u'CH', u'C' ] ) b = lang.letters_by_first[ 'D' ] self.assertEquals( b, [ u'DZ', u'DŽ', u'D' ] ) def testBasics2( self ): lang = AtomobotLanguageSlovak() self.assertEquals( u'0' in lang.ch_types[ 'number' ], True ) self.assertEquals( u'!' in lang.ch_types[ 'symbol' ], True ) self.assertEquals( u'Č' in lang.ch_types[ 'letter' ], True ) def testDecompose1( self ): lang = AtomobotLanguageSlovak() lang.decompose( u'Ahoj' ) lang.decompose( u'Hello' ) lang.decompose( u'Chlieb' ) lang.decompose( u'Ráno' ) lang.decompose( u'Radosť' ) lang.decompose( u'Dzurinda' ) lang.decompose( u'Ďateľ' ) lang.decompose( u'Zlí psi' ) lang.decompose( u'Zlí psíci' ) def testComp1( self ): lang = AtomobotLanguageSlovak() self.assertEquals( lang.compare_ci( u'A', u'B' ), -1 ) self.assertEquals( lang.compare_ci( u'D', u'B' ), 1 ) self.assertEquals( lang.compare_ci( u'B', u'B' ), 0 ) self.assertEquals( lang.compare_ci( u'C', u'Č' ), -1 ) self.assertEquals( lang.compare_ci( u'D', u'DZ' ), -1 ) self.assertEquals( lang.compare_ci( u'DZ', u'Ď' ), 1 ) self.assertEquals( lang.compare_ci( u'C', u'CH' ), -1 ) self.assertEquals( lang.compare_ci( u'H', u'CH' ), -1 ) self.assertEquals( lang.compare_ci( u'CH', u'I' ), -1 ) self.assertEquals( lang.compare_ci( u'dzedzina', u'ďateľ' ), 1 ) self.assertEquals( lang.compare_ci( u'chalupa', u'hlad' ), 1 ) if __name__ == '__main__': unittest.main()
Text is available under the CC BY-SA 4.0 license; additional terms may apply.
Images, videos and audio are available under their respective licenses.