def testSizeParagraphsForKivyLabelAllShiftedLinesHaveForcedLineBreakCodeFile(self): ''' This test ensures that text resizing for the Kivy label destination works on a help file where the not shifted long lines are sized for better reading at help write time. ''' FILE_PATH = 'all_shifted_lines_have_break_code.txt' resizedTextPageList = '' width = 54 with open(FILE_PATH) as file: resizedTextPageList = HelpUtil.sizeParagraphsForKivyLabelFromFile(file, 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. ''', resizedTextPageList[0]) self.assertEqual(''' [b]Output price qualifiers[/b]: R = RT M = Minute price (precision at the minute) C = Close price [color=ffff00ff]btc usd 0 bittrex -v0.01btc[/color] --> 0.01 BTC/191.2 USD on BitTrex: 16/12/17 22:10R 19120''', resizedTextPageList[1])
def testSizeParagraphsForKivyLabelnRealPartialWithNoBreakLinesHelpFile(self): ''' This test ensures that text resizing for the Kivy label destination works on a help file where the not shifted long lines do not include any break. ''' FILE_PATH = 'partial_help_nobreaked_lines.txt' resizedTextPageList = '' width = 54 with open(FILE_PATH) as file: resizedTextPageList = HelpUtil.sizeParagraphsForKivyLabelFromFile(file, width) 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''', resizedTextPageList[0])
def testSizeParagraphsForKivyLabelnRealPartialWithBreakLinesHelpFile(self): ''' This test ensures that text resizing for the Kivy label destination works on a help file where the not shifted long lines are sized for better reading at help write time. ''' FILE_PATH = 'partial_help_breaked_lines.txt' resizedTextPageList = '' width = 54 with open(FILE_PATH) as file: resizedTextPageList = HelpUtil.sizeParagraphsForKivyLabelFromFile(file, width) 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. ''', resizedTextPageList[0]) self.assertEqual(''' [b]Output price qualifiers[/b]: R = RT M = Minute price (precision at the minute) C = Close price Examples: assume we are on 16/12/17 at 22:10 [color=ffff00ff]btc usd 0 bittrex[/color] --> BTC/USD on BitTrex: 16/12/17 22:10R 19120 [color=ffff00ff]eth btc 16/12 13:45 bitfinex[/color] --> ETH/BTC on Bitfinex: 16/12/17 13:45M 0.03893 [color=ffff00ff]eth btc 13:45 bitfinex[/color] --> ETH/BTC on Bitfinex: 16/12/17 13:45M 0.03893 [color=ffff00ff]eth btc 15 8:45 bitfinex[/color] --> ETH/BTC on Bitfinex: 15/12/17 8:45M 0.03782 [color=ffff00ff]eth btc 21/1 13:45 bitfinex[/color] --> ETH/BTC on Bitfinex: 21/01/17C 0.01185 [color=ffff00ff]btc usd 0 bittrex -v0.01btc[/color] --> 0.01 BTC/191.2 USD on BitTrex: 16/12/17 22:10R 19120 [b][color=ff0000]WARNING[/color][/b]: <options> must be specified at the end of the full command price''', resizedTextPageList[1])