def test_add_new_shelf(self): # тест: вернула ли функция True или False в зависимости от входных данных: self.assertEqual(app.add_new_shelf('new_test_shelf'), ('new_test_shelf', True)) self.assertEqual(app.add_new_shelf('1'), ('1', False)) # тест: появился ли действительно новый элемент в directories self.assertIn('new_test_shelf', app.directories.keys())
def test_add_new_shelf(self): with patch('app.input') as in_mock: in_mock.return_value = '4' shelf_nubmer, shelf_nubmer_bool = app.add_new_shelf() self.assertTrue(shelf_nubmer_bool) in_mock.return_value = '1' shelf_nubmer, shelf_nubmer_bool = app.add_new_shelf() self.assertFalse(shelf_nubmer_bool)
def test_add_new_shelf(self): shelf_before = list(app.directories.keys()) self.assertTrue(shelf_before) self.assertTupleEqual(app.add_new_shelf(shelf_before[0]), (shelf_before[0], False)) new_shelf = 'new' with patch('app.input', return_value=new_shelf): self.assertTupleEqual(app.add_new_shelf(), (new_shelf, True))
def test_add_new_shelf(self): shelf_num = '999999' with patch('app.input', return_value=shelf_num): result_true = app.add_new_shelf() with patch('app.input', return_value=shelf_num): result_false = app.add_new_shelf() self.assertTrue(result_true[1]) self.assertEqual(shelf_num, result_true[0]) self.assertFalse(result_false[1]) self.assertEqual(shelf_num, result_false[0])
def test_add_new_shelf(self): user_input = ['4'] with patch('app.input', side_effect=user_input): shelf_number, flag = app.add_new_shelf() self.assertEqual(shelf_number, '4') self.assertTrue(flag) user_input = ['2'] with patch('app.input', side_effect=user_input): shelf_number, flag = app.add_new_shelf() self.assertEqual(shelf_number, '2') self.assertFalse(flag)
def test_add_new_doc_shelf(self): result = app.add_new_doc('2207 876234', 'passport', 'Василий Гупкин', '1') assert result == '1' result = app.add_new_doc('11-2', 'invoice', 'Геннадий Покемонов', '1') assert result == '1' result = app.add_new_doc('10006', 'insurance', 'Аристарх Павлов', '2') assert result == '2' shelf_num, is_new = app.add_new_shelf(3) assert shelf_num == '3' assert is_new etalon_docs = app.update_documents() etalon_dirs = app.update_directories() assert app.documents == etalon_docs assert app.directories == etalon_dirs
def test_add_new_shelf(self): shelf_quantity_before = len(self.dirs) app.add_new_shelf('4') shelf_quantity_after = len(self.dirs) self.assertLess(shelf_quantity_before, shelf_quantity_after)
def test_1(self, directories): directories.return_value = self.directories old_dict = directories.copy() add_new_shelf('55555') self.assertNotEqual(old_dict, directories)
def test_add_new_shelf(self): before_add = copy.deepcopy(self.dirs) with patch('app.input', return_value='5'): app.add_new_shelf() self.assertNotEqual(self.dirs, before_add)
def test_add_new_shelf(self): with patch('app.input', return_value='5') as _: self.assertTrue(app.add_new_shelf())
def test_negative_add_new_shelf(self): shelf_num = '1' self.assertIn(shelf_num, app.directories.keys()) with patch('app.input', return_value=shelf_num): result = app.add_new_shelf() self.assertFalse(result[1])
def test_add_new_shelf(self): before_len = len(self.dirs.keys()) with patch('app.input', return_value='test'): app.add_new_shelf() self.assertGreater(len(self.dirs), before_len)
def test_add_new_shelf(self): before_len = len(app.directories) app.add_new_shelf(shelf_number=4) self.assertGreater(len(app.directories), before_len)
def test_add_new_shelf2(self, mock_shelf2): mock_shelf2.return_value = '2' result = add_new_shelf() self.assertEqual(('2', False), result)
def test_add_new_shelf(self): self.assertNotIn('4', app.directories) with patch('app.input', return_value='4'): app.add_new_shelf('4') self.assertIn('4', app.directories)
def test_add_new_shelf(self): with patch('app.input', return_value='4'): app.add_new_shelf() self.assertIn('4', self.dirs.keys())
def test_add_new_shelf(self): with patch('app.input', return_value="4"): app.add_new_shelf() self.assertIn('4', directories.keys())
def test_add_new_shelf(self): app.add_new_shelf('4') self.assertEqual(len(self.dirs), 4)
def test_add_new_shelf(self): with patch('app.input', return_value='4'): self.assertIn(app.add_new_shelf()[0], directories.keys())
def test_new_shelf(self): with patch('app.input', return_value="9999"): app.add_new_shelf() self.assertGreater(len(self.dirs), self.shelf_length)
def testing_add_new_shelf(self): with patch('app.input', return_value='testNum'): app.add_new_shelf() self.assertIs(len(app.directories), 4)
def test_add_new_shelf(self): self.assertTrue(app.add_new_shelf("6")[1]) self.assertFalse(app.add_new_shelf("1")[1])
def test_add_new_shelf(self): shelf_num = '345' self.assertNotIn(shelf_num, app.directories.keys()) with patch('app.input', return_value=shelf_num): app.add_new_shelf() self.assertIn(shelf_num, app.directories.keys())
def test_add_new_shelf(self, mock_shelf): mock_shelf.return_value = '5' result = add_new_shelf() self.assertEqual(('5', True), result)
def test_add_new_shelf(self): start_len = (len(directories)) test_value = '12' self.assertNotIn(test_value, directories.keys()) app.add_new_shelf(test_value) self.assertNotEqual(start_len, len(directories))