//  [python]
def _run_and_test(self, hparams, discard_did=None):
        # Construct database
        text_data = tx.data.MultiAlignedData(hparams)
        self.assertEqual(
            text_data.vocab(0).size,
            self._vocab_size + len(text_data.vocab(0).special_tokens))

        iterator = text_data.dataset.make_initializable_iterator()
        text_data_batch = iterator.get_next()

        with self.test_session() as sess:
            sess.run(tf.global_variables_initializer())
            sess.run(tf.local_variables_initializer())
            sess.run(tf.tables_initializer())
            sess.run(iterator.initializer)

            while True:
                try:
                    # Run the logics
                    data_batch_ = sess.run(text_data_batch)

                    self.assertEqual(set(data_batch_.keys()),
                                     set(text_data.list_items()))
                    self.assertEqual(text_data.utterance_cnt_name('2'),
                                     '2_utterance_cnt')
                    text_0 = data_batch_['0_text']
                    text_1 = data_batch_['1_text']
                    text_2 = data_batch_['2_text']
                    int_3 = data_batch_['label']
                    number_1 = data_batch_['4_number1']
                    number_2 = data_batch_['4_number2']
                    text_3 = data_batch_['4_text']

                    # pylint: disable=invalid-name
                    for t0, t1, t2, i3, n1, n2, t4 in zip(
                        text_0, text_1, text_2, int_3,
                            number_1, number_2, text_3):

                        np.testing.assert_array_equal(
                            t0[:2], t1[1:3])
                        np.testing.assert_array_equal(
                            t0[:3], t2[0][:3])
                        if t0[0].startswith(b'This'):
                            self.assertEqual(i3, 0)
                        else:
                            self.assertEqual(i3, 1)
                        self.assertEqual(n1, 128)
                        self.assertEqual(n2, 512)
                        self.assertTrue(isinstance(n1, np.int64))
                        self.assertTrue(isinstance(n2, np.float32))
                        self.assertTrue(isinstance(t4, bytes))

                    if discard_did is not None:
                        hpms = text_data._hparams.datasets[discard_did]
                        max_l = hpms.max_seq_length
                        max_l += text_data._decoder[discard_did].added_length
                        for i in range(2):
                            for length in data_batch_[text_data.length_name(i)]:
                                self.assertLessEqual(length, max_l)
                        for lengths in data_batch_[text_data.length_name(2)]:
                            for length in lengths:
                                self.assertLessEqual(length, max_l)
                    for i, hpms in enumerate(text_data._hparams.datasets):
                        if hpms.data_type != "text":
                            continue
                        max_l = hpms.max_seq_length
                        mode = hpms.length_filter_mode
                        if max_l is not None and mode == "truncate":
                            max_l += text_data._decoder[i].added_length
                            for length in data_batch_[text_data.length_name(i)]:
                                self.assertLessEqual(length, max_l)

                except tf.errors.OutOfRangeError:
                    print('Done -- epoch limit reached')
                    break