Best Python code snippet using avocado_python
test_combinationMatrix.py
Source:test_combinationMatrix.py
...109 self.assertEqual(excepted_covered_more_than_ones, self.matrix.total_covered_more_than_ones,110 "Total uovered_more_than_ones number is wrong.")111 self.assertEqual(excepted_uncovered_row_size, len(self.matrix.uncovered_rows),112 "Matrix has wrong uncovered row size")113 def test_uncover_solution_row(self):114 solution_row = [1, 0, 2, 3]115 self.matrix.cover_solution_row(solution_row)116 self.matrix.uncover_solution_row(solution_row)117 excepted_uncovered_row_size = 6118 excepted_uncovered = 63119 excepted_covered_more_than_ones = 0120 self.assertEqual(excepted_uncovered, self.matrix.total_uncovered, "Total uncovered number is wrong.")121 self.assertEqual(excepted_covered_more_than_ones, self.matrix.total_covered_more_than_ones,122 "Total uovered_more_than_ones number is wrong.")123 self.assertEqual(excepted_uncovered_row_size, len(self.matrix.uncovered_rows),124 "Matrix has wrong uncovered row size")125 for key in self.matrix.hash_table:126 with self.subTest(combination=key):127 self.assertTrue(combination_row_equals(self.matrix.hash_table[key], self.excepted_hash_table[key]))128 self.matrix.cover_solution_row(solution_row)129 self.matrix.cover_solution_row(solution_row)130 self.excepted_hash_table[0, 1].cover_cell((1, 0))131 self.excepted_hash_table[0, 2].cover_cell((1, 2))132 self.excepted_hash_table[0, 3].cover_cell((1, 3))133 self.excepted_hash_table[1, 2].cover_cell((0, 2))134 self.excepted_hash_table[1, 3].cover_cell((0, 3))135 self.excepted_hash_table[2, 3].cover_cell((2, 3))136 self.matrix.uncover_solution_row(solution_row)137 excepted_uncovered_row_size = 6138 excepted_uncovered = 57139 excepted_covered_more_than_ones = 0140 self.assertEqual(excepted_uncovered, self.matrix.total_uncovered, "Total uncovered number is wrong.")141 self.assertEqual(excepted_covered_more_than_ones, self.matrix.total_covered_more_than_ones,142 "Total uovered_more_than_ones number is wrong.")143 self.assertEqual(excepted_uncovered_row_size, len(self.matrix.uncovered_rows),144 "Matrix has wrong uncovered row size")145 for key in self.matrix.hash_table:146 with self.subTest(combination=key):147 self.assertTrue(combination_row_equals(self.matrix.hash_table[key], self.excepted_hash_table[key]))148 def test_uncover_combination(self):149 solution_row = [1, 0, 2, 3]150 self.matrix.cover_solution_row(solution_row)...
test_cit.py
Source:test_cit.py
...76 def test_change_one_column(self):77 final_matrix = self.cit.final_matrix_init()78 while self.cit.combination_matrix.total_uncovered == 0:79 delete_row = final_matrix.pop(random.randint(0, len(final_matrix) - 1))80 self.cit.combination_matrix.uncover_solution_row(delete_row)81 expected_total_covered_more_than_ones = self.cit.combination_matrix.total_covered_more_than_ones82 expected_total_uncovered = self.cit.combination_matrix.total_uncovered83 expected_uncovered_rows = copy(self.cit.combination_matrix.uncovered_rows)84 row, row_index, column_index = self.cit.change_one_column(final_matrix)85 self.assertEqual(expected_total_uncovered, self.cit.combination_matrix.total_uncovered, "Coverage was change")86 self.assertEqual(expected_total_covered_more_than_ones,87 self.cit.combination_matrix.total_covered_more_than_ones,88 "Coverage was change")89 self.assertEqual(expected_uncovered_rows, self.cit.combination_matrix.uncovered_rows, "Coverage was change")90 self.assertNotEqual(final_matrix[row_index][column_index[0]], row[column_index[0]], "Value did not change")91 row[column_index[0]] = final_matrix[row_index][column_index[0]]92 self.assertEqual(final_matrix[row_index], row, "Different value was changed")93 def test_get_missing_combination_random(self):94 final_matrix = self.cit.final_matrix_init()95 while self.cit.combination_matrix.total_uncovered == 0:96 delete_row = final_matrix.pop(random.randint(0, len(final_matrix) - 1))97 self.cit.combination_matrix.uncover_solution_row(delete_row)98 combination_parameters, combination = self.cit.get_missing_combination_random()99 self.assertEqual(0, self.cit.combination_matrix.hash_table[combination_parameters].hash_table[combination],100 "Combination is already covered")101 def test_cover_missing_combination(self):102 final_matrix = self.cit.final_matrix_init()103 while self.cit.combination_matrix.total_uncovered == 0:104 delete_row = final_matrix.pop(random.randint(0, len(final_matrix) - 1))105 self.cit.combination_matrix.uncover_solution_row(delete_row)106 expected_total_covered_more_than_ones = self.cit.combination_matrix.total_covered_more_than_ones107 expected_total_uncovered = self.cit.combination_matrix.total_uncovered108 expected_uncovered_rows = copy(self.cit.combination_matrix.uncovered_rows)109 row, row_index, parameters = self.cit.cover_missing_combination(final_matrix)110 self.assertEqual(expected_total_uncovered, self.cit.combination_matrix.total_uncovered, "Coverage was change")111 self.assertEqual(expected_total_covered_more_than_ones,112 self.cit.combination_matrix.total_covered_more_than_ones,113 "Coverage was change")114 self.assertEqual(expected_uncovered_rows, self.cit.combination_matrix.uncovered_rows, "Coverage was change")115 self.assertTrue(final_matrix[row_index][parameters[0]] != row[parameters[0]] or116 final_matrix[row_index][parameters[1]] != row[parameters[1]], "Value did not change")117 row[parameters[0]] = final_matrix[row_index][parameters[0]]118 row[parameters[1]] = final_matrix[row_index][parameters[1]]119 self.assertEqual(final_matrix[row_index], row, "Different value was changed")
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!!