Пример #1
0
 def test_getListOfParagraphsSizedForKivyLabel(self):
     text = 'CryptoPricer full request\n\n\nbtc usd 0 all\n\n\nReturns the current price of 1 btc in usd.\n\nThe price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.\n\n\n\nNext section\n\n\nThis section explains the preceeding section'
     width = 60
     list = HelpUtil._getListOfParagraphsSizedForKivyLabel(text, width)
     self.assertEqual(len(list), 11)
     self.assertEqual(list[0],'CryptoPricer full request')
     self.assertEqual(list[1],'\n\n')
     self.assertEqual(list[2],'btc usd 0 all')
     self.assertEqual(list[3],'\n\n')
     self.assertEqual(list[4],'Returns the current price of 1 btc in usd.')
     self.assertEqual(list[5],'\n')
     self.assertEqual(list[6],'The price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.')
     self.assertEqual(list[7],'\n\n\n')
     self.assertEqual(list[8],'Next section')
     self.assertEqual(list[9],'\n\n')
     self.assertEqual(list[10],'This section explains the preceeding section')
Пример #2
0
    def test_getListOfParagraphsSizedForKivyLabelWithTabCodedParagraph(self):
        text = '[t]a first right shifted paragraph\n\n\n[t]btc usd 0 all\n\n\nReturns the current price of 1 btc in usd.\n\n[t]The price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.\n\n\n\nNext section\n\n\n[t]This section explains the preceeding section'

        width = 30
        list = HelpUtil._getListOfParagraphsSizedForKivyLabel(text, width)
        self.assertEqual(17, len(list))
        self.assertEqual(list[0],'[t]a first right shifted')
        self.assertEqual(list[1],'[t]paragraph')
        self.assertEqual(list[2],'\n\n')
        self.assertEqual(list[3],'[t]btc usd 0 all')
        self.assertEqual(list[4],'\n\n')
        self.assertEqual(list[5],'Returns the current price of 1 btc in usd.')
        self.assertEqual(list[6],'\n')
        self.assertEqual(list[7],'[t]The price is an average of')
        self.assertEqual(list[8],'[t]the btc quotation on all')
        self.assertEqual(list[9],'[t]the exchanges. It is')
        self.assertEqual(list[10],'[t]computed by the crypto')
        self.assertEqual(list[11],'[t]prices provider.')
        self.assertEqual(list[12],'\n\n\n')
        self.assertEqual(list[13],'Next section')
        self.assertEqual(list[14],'\n\n')
        self.assertEqual(list[15],'[t]This section explains the')
        self.assertEqual(list[16],'[t]preceeding section')