Best Python code snippet using pyshould_python
test_trajadataframe.py
Source:test_trajadataframe.py
...74 def test_plot_collection(self):75 self.coll.plot()76 # Test with colors77 self.coll.plot(colors={1: "red", 2: "blue"})78 def test_apply_all(self):79 angles = self.coll.apply_all(traja.calc_angle)80 assert isinstance(angles, pd.DataFrame)81 # Test with multiple ids82 coll_copy = self.coll.copy()83 coll_copy.loc[coll_copy.index[:5], "TrackId"] = 184 angles = coll_copy.apply_all(traja.calc_angle)...
test_frames.py
Source:test_frames.py
...22def test_split():23 frames.split(df, ['feature1'])24def test_take():25 frames.take(df, ['feature1'])26def test_apply_all():27 def sum(x):28 return x.sum()29 print frames.apply_all(df, sum)30def test_sort_rows():31 df = create_test_df_v2()32 sorted = frames.sort_rows(df, lambda x: x.mean())33 assert_array_equal(sorted.index, [6,8, 9, 2, 0, 1, 3, 4, 5, 10, 11, 7])34def test_sort_columns():35 df = create_test_df_v2()36 frames.sort_columns(df, lambda x: x.mean())37def test_map_functions():38 df = create_test_df_v2()39 frames.map_functions(df, [lambda x: x.feature1, lambda x: x.feature1 + x.feature2])40def test_with_new_columns():...
test_rulebase.py
Source:test_rulebase.py
...3from unittest import TestCase4root_folder = 'tests/sample_data'5summary_path = 'tests/test_output/Rulebase_Summary.csv'6class TestRuleBase(TestCase):7 def test_apply_all(self):8 rulebase.apply_all([os.path.join(root_folder, 'flags/DE_02483_QC.txt')], summary_path)9 10 # Compare output QC'd data file with benchmark11 benchmark_file_path = os.path.join(root_folder, "QCd_Data/DE_02483.txt")12 test_output_path = "tests/test_output/QCd_Data/DE_02483.txt"13 with open(benchmark_file_path, "r") as benchmark_file:14 benchmark_output = benchmark_file.readlines()15 with open(test_output_path, "r") as test_file:16 test_output = test_file.readlines()17 self.assertEqual(test_output, benchmark_output)18 def test_apply(self):19 rulebase.apply_rulebase(os.path.join(root_folder, 'flags/DE_02483_QC.txt'), os.path.dirname(summary_path),...
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!!