def test_decodeMarkups(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._decodeMarkups(text) 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)
def test_decodeMarkupsOnRealPartialHelpFile(self): FILE_PATH = 'partial_help.txt' text = '' with open(FILE_PATH) as file: text = file.read() width = 54 resizedText = HelpUtil._decodeMarkups(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)
def test_decodeMarkupsFromFile(self): FILE_PATH = 'scrollablePopupMarkupTest.txt' text = '' with open(FILE_PATH) as markupFile: text = markupFile.read() width = 54 resizedText = HelpUtil._decodeMarkups(text) 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)