How to use test_basic_functions method in avocado

Best Python code snippet using avocado_python

data_generation_test.py

Source:data_generation_test.py Github

copy

Full Screen

...3import pandas as pd4from bcselector.variable_selection import DiffVariableSelector, FractionVariableSelector, NoCostVariableSelector5from bcselector.data_generation import MatrixGenerator, DataFrameGenerator6class TestMatrixGenerator(unittest.TestCase):7 def test_basic_functions(self):8 # Given9 n_rows = 100010 n_cols = 1011 seed = 012 # When13 mg = MatrixGenerator()14 X, y, costs = mg.generate(n_rows=n_rows,n_basic_cols=n_cols,seed=seed)15 # Then16 self.assertEqual(X.shape[0],n_rows)17 self.assertEqual(X.shape[1],n_cols)18 self.assertEqual(len(y), n_rows)19 self.assertEqual(len(costs), n_cols)20 def test_seed_repetition(self):21 # Given22 n_rows = 100023 n_cols = 1024 seed = 025 # When26 mg = MatrixGenerator()27 X_1, y_1, costs_1 = mg.generate(n_rows=n_rows,n_basic_cols=n_cols,noise_sigmas = [0.9,0.8,0.3,0.1],seed=seed)28 X_2, y_2, costs_2 = mg.generate(n_rows=n_rows,n_basic_cols=n_cols,noise_sigmas = [0.9,0.8,0.3,0.1],seed=seed)29 X_3, y_3, costs_3 = mg.generate(n_rows=n_rows,n_basic_cols=n_cols,noise_sigmas = [0.9,0.8,0.3,0.1],seed=seed + 1)30 # Then31 self.assertAlmostEqual(X_1.sum(), X_2.sum(), places = 5)32 self.assertNotAlmostEqual(X_1.sum(), X_3.sum(), places = 5)33 self.assertAlmostEqual(y_1.sum(), y_2.sum(), places = 5)34 self.assertNotAlmostEqual(y_1.sum(), y_3.sum(), places = 5)35 assert costs_1 == costs_2 == costs_336class TestDataFrameGenerator(unittest.TestCase):37 def test_basic_functions(self):38 # Given39 n_rows = 100040 n_cols = 1041 seed = 042 # When43 mg = DataFrameGenerator()44 X, y, costs = mg.generate(n_rows=n_rows,n_basic_cols=n_cols,seed=seed)45 # Then46 self.assertEqual(X.shape[0],n_rows)47 self.assertEqual(X.shape[1],n_cols)48 self.assertEqual(len(y), n_rows)49 self.assertEqual(len(costs), n_cols)50 def test_seed_repetition(self):51 # Given...

Full Screen

Full Screen

test_label_binarizer.py

Source:test_label_binarizer.py Github

copy

Full Screen

...25 [8, 2, 1, 2, 2])]26)27@pytest.mark.parametrize("dtype", [cp.int32, cp.int64])28@pytest.mark.parametrize("sparse_output", [True, False])29def test_basic_functions(labels, dtype, sparse_output):30 fit_labels, xform_labels = labels31 skl_bin = skLB(sparse_output=sparse_output)32 skl_bin.fit(fit_labels)33 fit_labels = cp.asarray(fit_labels, dtype=dtype)34 xform_labels = cp.asarray(xform_labels, dtype=dtype)35 binarizer = LabelBinarizer(sparse_output=sparse_output)36 binarizer.fit(fit_labels)37 assert array_equal(binarizer.classes_.get(),38 np.unique(fit_labels.get()))39 xformed = binarizer.transform(xform_labels)40 if sparse_output:41 skl_bin_xformed = skl_bin.transform(xform_labels.get())42 if has_scipy():43 import scipy.sparse44 else:45 pytest.skip('Skipping test_basic_functions(sparse_output=True) ' +46 'because Scipy is missing')47 skl_csr = scipy.sparse.coo_matrix(skl_bin_xformed).tocsr()48 cuml_csr = xformed49 array_equal(skl_csr.data, cuml_csr.data.get())50 # #todo: Support sparse inputs51 # xformed = xformed.todense().astype(dtype)52 assert xformed.shape[1] == binarizer.classes_.shape[0]53 original = binarizer.inverse_transform(xformed)54 assert array_equal(original.get(),...

Full Screen

Full Screen

test.py

Source:test.py Github

copy

Full Screen

...11]12class GoogleSheetsTest(unittest.TestCase):13 spreadsheet = Spreadsheet()14 manager = SpreadsheetManager(spreadsheet)15 def test_basic_functions(self):16 print('test_basic_functions()')17 print('Creating new spreadsheet...', end=' ')18 self.spreadsheet.create_spreadsheet()19 # print(f'done. (Spreadsheet ID: {self.spreadsheet.spreadsheetId})')20 print('Loading data there...', end=' ')21 self.spreadsheet.update_data(data=easy_test_data, range_name='A1:B2')22 # print('done.')23 print('Getting values...', end=' ')24 self.spreadsheet.get_data_by_range('A1:B2')25 # print('done.')26 print('Clearing values...', end=' ')27 self.spreadsheet.clear_data('A1:B2')28 print('done.')29 print('Deleting spreadsheet...', end=' ')30 self.spreadsheet.delete_spreadsheet(self.spreadsheet.spreadsheetId)...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful