Exemplo n.º 1
0
    def test_total_notes_failed(self):
        report = Report('João Lucas')
        totalMath = report.math_total(0.0, 2.0, 0.0, 1.0)
        totalEnglish = report.english_total(0.0, 10.0, 1.0, 2.0)

        result = report.total_notes(totalMath, totalEnglish)
        self.assertEqual(result, '😭 infelizmente você foi reprovado')
Exemplo n.º 2
0
    def test_total_notes_success(self):
        report = Report('João Lucas')
        totalMath = report.math_total(8.0, 2.0, 4.0, 5.0)
        totalEnglish = report.english_total(8.0, 10.0, 4.0, 5.0)

        result = report.total_notes(totalMath, totalEnglish)
        self.assertEqual(result, '🔥 você foi aprovado')
 def test_generateReport(self):
     Report(
         self.account, os.getcwd()
     )  # generates the output in the current directory with filename 'Personal Finance Report'
     filename_path = os.path.join(os.getcwd(),
                                  "Personal Finance Report.pdf")
     self.assertTrue(os.path.exists(filename_path))
def gather_statistics(documents):
    statistics = {}
    failed = {}
    count = 1
    fail_count = 0
    total = len(documents.keys())

    for filename, document in documents.items():
        print(f"Now analyzing document: {count}/{total}, failed: {fail_count}")
        count += 1
        try:
            report = Report(document)
            statistics[filename] = {
                "tonality": report.tonality(),
                "reading_attributes": report.reading_attributes(),
            }
        except Exception as error:
            fail_count += 1
            failed[filename] = {'text': report.to_text(), 'error': str(error)}
    return (statistics, failed)
Exemplo n.º 5
0
 def setUp(self):
     self.mock_db_handler = MagicMock()
     self.report = Report(self.mock_db_handler)
Exemplo n.º 6
0
class TestReport(unittest.TestCase):
    """
    Tests for the report class
    """
    def setUp(self):
        self.mock_db_handler = MagicMock()
        self.report = Report(self.mock_db_handler)

    # Test viewing a group
    def test_view_report(self):
        self.mock_db_handler.find.return_value = {
            'content': 'COVID',
            'group': 'Lacrosse',
            'timestamp': datetime.today().strftime('%d%m%Y'),
            '_id': 45
        }
        expected_result = {
            'content': 'COVID',
            'group': 'Lacrosse',
            'timestamp': '02122020'
        }
        with app.test_request_context('report/45',
                                      json={
                                          'content':
                                          'COVID',
                                          'group':
                                          'Lacrosse',
                                          'timestamp':
                                          datetime.today().strftime('%d%m%Y'),
                                          '_id':
                                          45
                                      }):
            actual_result = self.report.view_report(45)
            self.assertEqual(expected_result, actual_result)

    # Test deleting a group
    def test_delete_report(self):
        self.mock_db_handler.find.return_value = 'foo'
        expected_result = None
        with app.test_request_context('report/45'):
            actual_result = self.report.delete_report('45')
            self.assertEqual(expected_result, actual_result)

    # Test updating a group
    def test_update_report(self):
        self.mock_db_handler.create.return_value = 'test'
        expected_result = {
            'content': 'COVID',
            'group': 'Lacrosse',
            'timestamp': datetime.today().strftime('%d%m%Y'),
            '_id': 45
        }
        with app.test_request_context('report/45',
                                      json={
                                          'content':
                                          'COVID',
                                          'group':
                                          'Lacrosse',
                                          'timestamp':
                                          datetime.today().strftime('%d%m%Y'),
                                          '_id':
                                          45
                                      }):
            actual_result = self.report.update_report_contents(45)
            self.assertEqual(expected_result, actual_result)
Exemplo n.º 7
0
 def __init__(self, db_handler):
     self.db_handler = db_handler
     self.report = Report(self.db_handler)
Exemplo n.º 8
0
from src.extract import Extract
from src.report import Report

if __name__ == "__main__":
    extract = Extract()
    # Ingest data
    data = extract.get_events_data_from_file("../input/input.txt")
    extract.ingest(data)

    # Run report
    report = Report()
    report.TopXSimpleLTVCustomers(10)

    #
    # week = dt.strftime("%U")
    # year = dt.strftime("%Y")
    #
    # # 53rd week of previous year will be combined with 0th week of next year
    # if week == "53":
    #     week = '00'
    #     temp_year = int(year) + 1
    #     year = str(temp_year)
    #
    # weekly_visit_key = year + '-' + week
    # print (weekly_visit_key)
    #
    #
    #
    # # d = "2017-01-06T12:45:52.041Z"
    # # r = datetime.datetime.strptime(d + '-0', "%Y-%M-%DT%H-%M-W%W-%w")
    # # print(r)
Exemplo n.º 9
0
from pathlib import Path
import plotly.graph_objects as px
from pandas import read_csv
from src.report import Report

# Do not change these lines.
__winc_id__ = 'a2bc36ea784242e4989deb157d527ba0'
__human_name__ = 'superpy'

# Your code below this line.

# Date written to file.
internal_date = datetime.now().date()
# Actual current OS date.
current_date = datetime.now().date()
report = Report('sold.csv', 'bought.csv')


def main():
    global internal_date
    parser = argparse.ArgumentParser(description='Process some integers.')
    # parser.add_argument('type', type = str, help = 'Type of action, must be either buy, sell, report or advance.')
    subparsers = parser.add_subparsers(title='subcommands',
                                       description='valid subcommands',
                                       help='additional help',
                                       dest='type')

    # Command Buy
    parser_buy = subparsers.add_parser(
        'buy',
        help='Command for when you want to register a product as bought.')
Exemplo n.º 10
0
    StringVars.append(StringVar())
    Labels.append(Label(TOP, textvariable=StringVars[0]))
    td = datetime.datetime(2018, 5, 11) - datetime.datetime.now()
    StringVars[0].set("mid :" + str(td.days))
    Labels[0].grid(row=1, column=0)

    T = Text(TOP, height=50, width=70)
    S = Scrollbar(TOP, command=T.yview)
    T.grid(row=2, column=0, sticky="nsew")
    S.grid(row=2, column=1, sticky="nsew")
    S.config(command=T.yview)
    T.config(yscrollcommand=S.set)
    ss = src.getfilemtime.write_today_work(filelist, CURRENTDAY)
    T.insert(END, ss)
    MENUBAR = init_menu(root)
    TOP.pack()
    root.config(menu=MENUBAR)
    #Ann = Tasklist("winter_holiday")
    #Ann = Tasklist("new_term")

    Cnn = Cal()
    Rnn = Report(Ann)
    Cnn.fetch_activity()
    CheckVar = []
    Checkbox = []
    Ent = []

    Lb1 = Listbox(TOP)
    frame2 = Frame(TOP)
    root.mainloop()
Exemplo n.º 11
0
 def test_math_total(self):
     report = Report('João Lucas')
     total = report.math_total(8.0, 2.0, 4.0, 5.0)
     self.assertEqual(total, 19.0)
Exemplo n.º 12
0
 def test_english_total(self):
     report = Report('João Lucas')
     total = report.english_total(8.0, 10.0, 4.0, 5.0)
     self.assertEqual(total, 27.0)
Exemplo n.º 13
0
def __build_report(report_path: Path) -> Report:
    report_file = ReportFileProcessor(report_path)
    blocks = report_file.blocks
    report_name = report_path.stem
    return Report(report_name, blocks)