Best Python code snippet using pandera_python
yandex.py
Source:yandex.py
...30 url = 'https://api.exchangerate.host/latest'31 response = requests.get(url, verify=False)32 data = response.json()33 ti.xcom_push(key='ubs', value=data)34def transform_data(**kwargs):35 ti = kwargs['ti']36 data = ti.xcom_pull(key='ubs', task_ids=['extract_data'])[0]37 is_success = data["success"]38 base = data["base"]39 date = data["date"]40 rates = data['rates']41 df = pd.DataFrame()42 df["id"] = 143 df["base"] = [base]44 df["date"] = [date]45 coll = list(rates.keys())46 vall = list(rates.values())47 #можно бÑло ÑделаÑÑ df[coll] = vall. Ðо на более ÑÑаÑÑÑ
веÑÑиÑÑ
пиÑона не ÑабоÑаеÑ. ÐоÑÑÐ¾Ð¼Ñ Ð¿ÑобежимÑÑ Ñиклом48 for c,v in zip(coll,vall):...
dc_test.py
Source:dc_test.py
1import sys2import unittest3sys.path.insert(0, '..')4from transform.transform import TransformData5from transformtestrunner import TransformTestCase6from constants import *7class DuCheminTest(unittest.TestCase):8 def setUp(self):9 pass10 def test_emendations_DC0113(self):11 name = 'TC_Emendations.DC0113'12 mei_file = 'dat/DC0113E.mei'13 transform_data = TransformData()14 transform_data.arranger_to_editor = True15 transform_data.replace_longa = True16 transform_data.obliterate_incipit = True17 transform_data.editorial_resp = 'ZK'18 transform_data.alternates_list = [19 ('1', VARIANT, '1', ''),20 ('2', VARIANT, '2', ''),21 ('3', EMENDATION, '2', 'Freedman'),22 ('4', VARIANT, '4', ''),23 ('5', VARIANT, '5', ''), 24 ('6', EMENDATION, '5', 'Freedman'), 25 ]26 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()27 # TODO: do some asserts on transformed_mei28 def test_reconstructions_DC1209(self):29 name = 'TC_Reconstructions.DC1209'30 mei_file = 'dat/DC1209E.mei'31 transform_data = TransformData()32 transform_data.arranger_to_editor = True33 transform_data.replace_longa = True34 transform_data.obliterate_incipit = True35 transform_data.editorial_resp = 'ZK'36 transform_data.alternates_list = [37 ('1', VARIANT, '1', ''),38 ('2', VARIANT, '2', ''),39 ('3', RECONSTRUCTION, '2', 'Apgar'),40 ('4', RECONSTRUCTION, '2', 'Busnel'),41 ('5', RECONSTRUCTION, '2', 'Freedman'),42 ('6', VARIANT, '6', ''), 43 ('7', VARIANT, '7', ''), 44 ('8', RECONSTRUCTION, '7', 'Apgar'),45 ('9', RECONSTRUCTION, '7', 'Busnel'),46 ('10', RECONSTRUCTION, '7', 'Freedman'),47 ]48 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()49 # TODO: do some asserts on transformed_mei50 def test_reconstructions_DC1313(self):51 name = 'TC_Reconstructions.DC1313'52 mei_file = 'dat/DC1313E.mei'53 transform_data = TransformData()54 transform_data.arranger_to_editor = True55 transform_data.replace_longa = True56 transform_data.obliterate_incipit = True57 transform_data.editorial_resp = 'ZK'58 transform_data.alternates_list = [59 ('1', VARIANT, '1', ''),60 ('2', VARIANT, '2', ''),61 ('3', RECONSTRUCTION, '2', 'Apgar'),62 ('4', RECONSTRUCTION, '2', 'Bruke'),63 ('5', RECONSTRUCTION, '2', 'Derycz'),64 ('6', RECONSTRUCTION, '2', 'Freedman'),65 ('7', VARIANT, '7', ''), 66 ('8', VARIANT, '8', ''), 67 ('9', RECONSTRUCTION, '8', 'Apgar'),68 ('10', RECONSTRUCTION, '8', 'Bruke'),69 ('11', RECONSTRUCTION, '8', 'Derycz'),70 ('12', RECONSTRUCTION, '8', 'Freedman'),71 ]72 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()73 # TODO: do some asserts on transformed_mei74 def test_variants_DC0221(self):75 name = 'TC_DC0221'76 mei_file = 'dat/DC0221E.mei'77 transform_data = TransformData()78 transform_data.arranger_to_editor = True79 transform_data.replace_longa = True80 transform_data.obliterate_incipit = True81 transform_data.editorial_resp = 'ZK'82 transform_data.alternates_list = [83 ('1', VARIANT, '1', ''),84 ('2', VARIANT, '1', 'ZK'),85 ('3', VARIANT, '1', 'ZK'),86 ('4', VARIANT, '4', ''),87 ('5', VARIANT, '4', 'ZK'),88 ('6', VARIANT, '4', 'ZK'),89 ('7', VARIANT, '7', ''),90 ('8', VARIANT, '7', 'ZK'),91 ('9', VARIANT, '7', 'ZK'),92 ('10', VARIANT, '10', ''),93 ('11', VARIANT, '10', 'ZK'),94 ('12', VARIANT, '10', 'ZK') ]95 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()96 # TODO: do some asserts on transformed_mei97 def test_emendationandvariant_DC0110(self):98 name = 'DC0110'99 mei_file = 'dat/DC0110E.mei'100 transform_data = TransformData()101 transform_data.arranger_to_editor = True102 transform_data.replace_longa = True103 transform_data.obliterate_incipit = True104 transform_data.editorial_resp = 'TEST_EDITOR'105 transform_data.alternates_list = [106 ('1', VARIANT, '1', ''),107 ('2', EMENDATION, '1', 'Freedman'),108 ('3', VARIANT, '3', ''),109 ('4', VARIANT, '4', ''),110 ('5', VARIANT, '5', ''), 111 ('6', VARIANT, '5', '1554/25'), 112 ]113 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()114 # TODO: do some asserts on transformed_mei115 def test_emendationandvariant_DC0909(self):116 name = 'DC0909'117 mei_file = 'dat/DC0909E.mei'118 transform_data = TransformData()119 transform_data.arranger_to_editor = True120 transform_data.replace_longa = True121 transform_data.obliterate_incipit = True122 transform_data.editorial_resp = 'TEST_EDITOR'123 transform_data.alternates_list = [124 ('1', VARIANT, '1', ''),125 ('2', VARIANT, '1', '1554/22'),126 ('3', VARIANT, '3', ''),127 ('4', EMENDATION, '3', 'Tanguy'),128 ('5', VARIANT, '3', '1554/22'), 129 ('6', VARIANT, '6', ''), 130 ('7', VARIANT, '6', '1554/22'), 131 ('8', VARIANT, '8', ''), 132 ('9', VARIANT, '8', '1554/22'), 133 ]134 transform_data.color_for_ficta = ANY_COLOR135 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()136 # TODO: do some asserts on transformed_mei137 def test_emendandreconstr_DC1323(self):138 name = 'DC1209'139 mei_file = 'dat/DC1323E.mei'140 transform_data = TransformData()141 transform_data.arranger_to_editor = True142 transform_data.replace_longa = True143 transform_data.obliterate_incipit = True144 transform_data.editorial_resp = 'TEST_EDITOR'145 transform_data.alternates_list = [146 ('1', VARIANT, '1', ''),147 ('2', VARIANT, '2', ''),148 ('3', RECONSTRUCTION, '2', 'Apgar'),149 ('4', RECONSTRUCTION, '2', 'Clement'),150 ('5', VARIANT, '5', ''),151 ('6', EMENDATION, '5', 'Chater'), 152 ('7', EMENDATION, '5', 'Tanguy'), 153 ('8', VARIANT, '8', ''),154 ('9', RECONSTRUCTION, '8', 'Apgar'),155 ('10', RECONSTRUCTION, '8', 'Clement'),156 ]157 transform_data.color_for_ficta = ANYCOLOR158 transformed_mei = TransformTestCase(name, mei_file, transform_data).Run()159 # TODO: do some asserts on transformed_mei160def suite():161 test_suite = unittest.TestSuite()162 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_emendations_DC0113'))163 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_reconstructions_DC1209'))164 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_reconstructions_DC1313'))165 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_variants_DC0221'))166 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_emendationandvariant_DC0110'))167 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_emendationandvariant_DC0909'))168 test_suite.addTest(unittest.TestLoader().loadTestsFromName('dc_test.DuCheminTest.test_emendandreconstr_DC1323'))...
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!!