예제 #1
0
    def test_sizeParagraphsForKivyLabelWithLongMarkupColorAndTabbedParagraphsFromFile(self):
        FILE_PATH = 'regularAndShiftedPopupLongMarkupTest.txt'
        text = ''

        with open(FILE_PATH) as file:
            text = file.read()

        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        self.assertEqual('''
[b][color=ff0000]CryptoPricer full and long title request[/color][/b]

btc usd 0 all

Returns the current price of 1 btc in usd.

This is a long explanation which will occupy several lines once reorganized by the Label itself.
    The [b][color=ffff00ff]price[/color][/b] is an average of the btc quotation on
    all the exchanges. It is computed by the crypto
    prices provider.
no tab line

    * new tabbed line

    * other tabbed line
    
    * last tabbed line


[b][color=19ff52ff]Next section[/color][/b]

This section explains the preceeding section''', resizedText)
예제 #2
0
    def test_sizeParagraphsForKivyLabelWithMarkupColor(self):
        text = '[b][color=ff0000]CryptoPricer full request[/color][/b]\n\nbtc usd 0 all\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\n[b][color=ff0000]Next section[/color][/b]\n\nThis section explains the preceeding section'
        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        self.assertEqual('''
[b][color=ff0000]CryptoPricer full request[/color][/b]

btc usd 0 all

Returns the current price of 1 btc in usd.

The price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.



[b][color=ff0000]Next section[/color][/b]

This section explains the preceeding section''',resizedText)
예제 #3
0
    def test_sizeParagraphsForKivyLabel(self):
        text = 'CryptoPricer full request\n\nbtc usd 0 all\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\nThis section explains the preceeding section'
        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        self.assertEqual('''
CryptoPricer full request

btc usd 0 all

Returns the current price of 1 btc in usd.

The price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.



Next section

This section explains the preceeding section''',resizedText)
예제 #4
0
    def test_sizeParagraphsForKivyLabelnRealPartialNoBreakLinesHelpFile(self):
        FILE_PATH = 'partial_help_nobreaked_lines.txt'
        text = ''

        with open(FILE_PATH) as file:
            text = file.read()

        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        #        resizedText = HelpUtil.decodeMarkup(text)
        self.assertEqual('''
[b][color=ff0000]Requesting RT and historical cryptocurrency prices[/b][/color]

CryptoPricer supports two kinds of requests: full requests and partial requests.

[b]Full request[/b]

<crypto> <unit> <date time> <exchange> <options>

<date time> possible values:

    [b][color=ffff00ff]0[/color][/b] for RT

    [b][color=ffff00ff]21/12 or 21/12/19 or 21/12/2019[/color][/b]. If no year is
    specified, current year is assumed. If no time is
    specified, current time is assumed.

    [b][color=ffff00ff]21/12 8:34[/color][/b] --> current year assumed

    21 8:34 --> here, since no month is specified,
    current month or previous month is assumed.

    8:34 --> here, since no date is specified, current
    date is assumed.

[b]WARNING[/b]: specifying time makes sense only for dates not older than 7 days. Prices older than 7 days are 'close' prices. Since there is no notion of a close price for crypto's, the last price of the date at UTC 23.59 is returned as 'close' price.

[b]Output price qualifiers[/b]:

    R = RT

    M = Minute price (precision at the minute)

    C = Close price''', resizedText)
예제 #5
0
    def test_sizeParagraphsForKivyLabelWithShiftedParagraphs(self):
        text = '''<date time> possible values:

    [b][cy]0[/cy][/b] for RT

    [b][cy]21/12 or 21/12/19 or 21/12/2019[/c][/b]. If no year is specified, current year is assumed. If no time is specified, current time is assumed.


    [b][cy]21/12 8:34[/c][/b] --> current year assumed'''

        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        self.assertEqual('''
<date time> possible values:

    [b][color=ffff00ff]0[/color][/b] for RT

    [b][color=ffff00ff]21/12 or 21/12/19 or 21/12/2019[/color][/b]. If no year is
    specified, current year is assumed. If no time is
    specified, current time is assumed.


    [b][color=ffff00ff]21/12 8:34[/color][/b] --> current year assumed''',resizedText)
예제 #6
0
    def test_sizeParagraphsForKivyLabelWithMarkupColorFromFile(self):
        FILE_PATH = 'popupMarkupTest.txt'
        text = ''

        with open(FILE_PATH) as markupFile:
            text = markupFile.read()

        width = 54
        resizedText = HelpUtil._sizeParagraphsForKivyLabel(text, width)
        self.assertEqual('''
[b][color=ff0000]CryptoPricer full request[/color][/b]

btc usd 0 all

Returns the current price of 1 btc in usd.

The price is an average of the btc quotation on all the exchanges. It is computed by the crypto prices provider.



[b][color=ff0000]Next section[/color][/b]

This section explains the preceeding section''', resizedText)