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

Blogs

Check out the latest blogs from LambdaTest on this topic:

Nov’22 Updates: Live With Automation Testing On OTT Streaming Devices, Test On Samsung Galaxy Z Fold4, Galaxy Z Flip4, & More

Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.

Considering Agile Principles from a different angle

In addition to the four values, the Agile Manifesto contains twelve principles that are used as guides for all methodologies included under the Agile movement, such as XP, Scrum, and Kanban.

How To Choose The Best JavaScript Unit Testing Frameworks

JavaScript is one of the most widely used programming languages. This popularity invites a lot of JavaScript development and testing frameworks to ease the process of working with it. As a result, numerous JavaScript testing frameworks can be used to perform unit testing.

How To Write End-To-End Tests Using Cypress App Actions

When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.

[LambdaTest Spartans Panel Discussion]: What Changed For Testing & QA Community And What Lies Ahead

The rapid shift in the use of technology has impacted testing and quality assurance significantly, especially around the cloud adoption of agile development methodologies. With this, the increasing importance of quality and automation testing has risen enough to deliver quality work.

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