def test_wrapper(): wrap("QtWidgets", QtWidgets, Element) from wrapper.QtWidgets import QLabel element = QLabel(text="hej") assert isinstance(element, Element) assert element.Class == QtWidgets.QLabel assert element.props == {"text": "hej"}
def process_files(): """ Process input files """ inputfiles = None outputfile = None encoding = constants.DEFAULT_ENCODING parser = liliargparser.LiliArgParser().parse() if (parser.getinputfiles()): inputfiles = parser.getinputfiles() if (parser.getencoding()): encoding = parser.getencoding() if (parser.getoutputfile()): outputfile = parser.getoutputfile() # Process input files for f in inputfiles: sr = script.Reader(f, encoding) sw = script.Writer(outputfile) messagecount = 0 for block in sr.read(): if (parser.warning_enabled()): warnings.check(block, f) if (parser.wordwrap_enabled()): wrapper.wrap(block) if (parser.format_enabled()): formatter.format(block) if (parser.verbose_enabled()): if len(block.gettext()) > 0 : messagecount += 1 if (not parser.warning_enabled()): if(parser.text_only()): sw.write(block, textonly=True) else: sw.write(block) if (parser.verbose_enabled()): print(f, ': ', messagecount, " text messages", sep='', file=sys.stderr)
def url(url, params=None, domain=None, parser=None): # parser: 'webpage' for bf4, 'rss' for feedparser url.on_failure = url_on_failure_handler # overwrite the function of instance domain = domain or get_domain(url) parser = parser or 'webpage' config = wrapper.wrap(url, params, domain) if parser == 'rss': interpreter.send_task(('%s.actor.rss' % PROJECT_NAME), args=config.args, kwargs=config.kwargs, routing_key='rss') elif parser == 'webpage': interpreter.send_task(('%s.actor.webpage' % PROJECT_NAME), args=config.args, kwargs=config.kwargs, routing_key='webpage')
import sys from dataclasses import dataclass from PySide2 import QtWidgets from PySide2.QtWidgets import QApplication, QSizePolicy import requests from wrapper import wrap from react import Element from react_qt import QtRenderer, style wrap('QtWidgets', QtWidgets, Element) from wrapper.QtWidgets import ( QCheckBox, QDialog, QHBoxLayout, QLabel, QLineEdit, QPushButton, QRadioButton, QSpacerItem, QTextEdit, QVBoxLayout, QWidget, ) @dataclass class Todo: description: str done: bool = False
def test_max_column_invalid(self): try: wrap("man", 0) self.fail() except ValueError as exception: self.assertEqual("Max column not allowed", exception.args[0])
def test_empty_text(self): self.assertEqual(wrap("", 2), "")
def final_test(self): self.assertEqual(wrap("man man man a tree a man", 7), "man man\nman a\ntree a\nman")
def test_max_column_greater_than_first_two_words_length(self): self.assertEqual(wrap("man quarter woman", 12), "man quarter\nwoman")
def test_max_column_equals_lowest_word_length_test(self): self.assertEqual(wrap("man woman", 3), "man\nwoman")
def test_max_column_equals_length_text(self): self.assertEqual(wrap("man woman", 9), "man woman")
import os import decompress import converter import wrapper decompress.decompress(os.listdir("_prproj")) converter.convert(os.listdir("decompressed")) wrapper.wrap(os.listdir("converted")) input("\nPress Enter to continue...")