Best Python code snippet using pandera_python
test_action.py
Source:test_action.py  
...12    'date_birthday': ('04.02.2020', 'ð'),13    'date_past': ('12.02.2020', 'ð¢'),14}15class TestAction:16    def test_to_format(self):17        str_to_converting = '21.11.2121'18        want = datetime.strptime(str_to_converting, '%d.%m.%Y')19        got = Helper.to_format(str_to_converting)20        assert want == got, f'want "{want}" != got "{got}"'21    @pytest.mark.parametrize(22        'date',23        {24            'date_past',25            'date_three',26            'date_two',27            'date_one',28            'date_birthday',29            'date_future',30        }31    )32    def test_set_status_birthday(self, date):33        date_birthday = datetime.strptime('04.02.2020', '%d.%m.%Y')34        db = DataBase()35        db._date_today = datetime.strptime(36            STATUS_AND_DATE[date][0],37            '%d.%m.%Y'38        )39        want = STATUS_AND_DATE[date][1]40        db._set_status_birthday(date_birthday=date_birthday)41        got = db._status_img42        assert want == db._status_img, f'want "{want}" != got "{got}"'43    def test_get_all_birthday(self, create_csv_birthday, read_csv):44        data_now = datetime.strptime('02.01.2020', '%d.%m.%Y')45        db = DataBase()46        db._date_today = data_now47        r = list()48        with codecs.open(49            Config.NAME_FILE_LIST_BIRTDAY, encoding='utf-8'50        ) as f:51            _rec_birthday = csv.reader(f)52            for i in _rec_birthday:53                r.append(i)54        db._rec_birthday = read_csv55        want = {56            'A': 'ð¢ 01.01',57            'B': 'ð 02.01',58            'C': 'â¡ 03.01',59            'D': 'â¡ 04.01',60            'F': 'â¡ 05.01',61            'G': 'ð£ 06.01'62        }63        got = db.get_all_birthday()64        assert want == got, f'want "{want}" != got "{got}"'65    def test_get_all_birthday(self, create_csv_birthday, read_csv):66        data_now = datetime.strptime('02.02.2020', '%d.%m.%Y')67        db = DataBase()68        db._date_today = data_now69        r = list()70        with codecs.open(71            Config.NAME_FILE_LIST_BIRTDAY, encoding='utf-8'72        ) as f:73            _rec_birthday = csv.reader(f)74            for i in _rec_birthday:75                r.append(i)76        db._rec_birthday = read_csv77        want = {78            '-A': 'ð¢ 12.01',79            'A': 'ð¢ 01.02',80            'B': 'ð 02.02',81            'C': 'â¡ 03.02',82            'D': 'â¡ 04.02',83            'F': 'â¡ 05.02',84            'G': 'ð£ 06.02'85        }86        got = db.get_all_birthday()87        assert want == got, f'want "{want}" != got "{got}"'88    def test_get_current_month_birthday(self, create_csv_birthday, read_csv):89        data_now = datetime.strptime('02.02.2020', '%d.%m.%Y')90        db = DataBase()91        db._date_today = data_now92        r = list()93        with codecs.open(94            Config.NAME_FILE_LIST_BIRTDAY, encoding='utf-8'95        ) as f:96            _rec_birthday = csv.reader(f)97            for i in _rec_birthday:98                r.append(i)99        db._rec_birthday = read_csv100        want = {101            'A': 'ð¢ 01.02',102            'B': 'ð 02.02',103            'C': 'â¡ 03.02',104            'D': 'â¡ 04.02',105            'F': 'â¡ 05.02',106            'G': 'ð£ 06.02'107        }108        got = db.get_current_month_birthday()109        assert want == got, f'want "{want}" != got "{got}"'110    def test_to_format(self):111        date = "22.12.2020"112        datetime_date = Helper().to_format(date)113        want = "<class 'datetime.datetime'>"114        got = str(type(datetime_date))...spider_plot_data.py
Source:spider_plot_data.py  
1import os2import csv3import matlab.engine4def test_to_format(test_number, lines):5    """6    Takes the test number and will output the formatted lists for that test7    test_number: line number in csv minus 2 (ignore column header and start index at 0)8    lines: all of the csv rows formatted as a list of strings9    """10    eng = matlab.engine.start_matlab()11    eng.cd('spiderPlot', nargout=0)12    l = lines[test_number]13    matlab_inputs = []14    for i, t in zip(range(5), [0,2,3,4,1]):15        avgs = []16        sds = []17        min_sd = 0.000118        for j in range(4):19            data = l[(t * 4) + (j + 1)]20            avg_sd = data.split(' +/- ')21            avg = float('%.4f'%(float(avg_sd[0]))) * 10022            sd = float('%.4f'%(float(avg_sd[1]))) * 10023            if j == 3:24                avg /= -10025                sd /= 10026            if sd < min_sd:27                sd = min_sd28            avgs.append(avg)29            sds.append(sd)30        matlab_inputs.append([e for e in avgs])31        matlab_inputs.append([e for e in sds])32        # print("D" + str(i + 1) + " = [" + ' '.join([str(elem) for elem in avgs]) + "];")33        # print("E" + str(i + 1) + " = [" + ' '.join([str(elem)+"," for elem in sds[:-1]]) + str(sds[-1]) + "];")34        avgs = []35        sds = []36    eng.spiderPlot(matlab.double(matlab_inputs), nargout=0)37def make_spider_plot():38    """39    Takes the data from ExperimentResults and outputs the format of the data to create the graphs.40    Will be able to copy and paste the output to radar_test.m for graph creation.41    """42    file_name = '../human_prob_models/scripts/csvFiles/ExperimentResults.csv'43    file = csv.reader(open(file_name), delimiter=',')44    lines = []45    for line in file:46        lines.append(line)47    lines = lines[1:]...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
