Ejemplo n.º 1
0
 def test__get_num_train_samples(self, mocked_get_num_samples, mocked_get_label_list):
     mocked_get_num_samples.return_value = 100
     base = utils.BaseTextCategorizationDataset(20, 0.8)
     self.assertEqual(base._get_num_train_samples(), 80)
Ejemplo n.º 2
0
 def test_index_to_label_and_label_to_index_are_identity(self, mocked_get_num_samples, mocked_get_label_list):
     mocked_get_label_list.return_value = ['a', 'b', 'c']
     base = utils.BaseTextCategorizationDataset(20, 0.8)
     label_to_index = base.get_label_to_index_map()
     for i, label in base.get_index_to_label_map().items():
         self.assertEqual(i, label_to_index[label])
Ejemplo n.º 3
0
 def test_to_indexes(self, mocked_get_num_samples, mocked_get_label_list):
     mocked_get_label_list.return_value = ['a', 'b', 'c']
     base = utils.BaseTextCategorizationDataset(20, 0.8)
     self.assertEqual(base.to_indexes(mocked_get_label_list.return_value), [0, 1, 2])
Ejemplo n.º 4
0
 def test_get_index_to_label_map(self, mocked_get_num_samples, mocked_get_label_list):
     mocked_get_label_list.return_value = ['a', 'b', 'c']
     base = utils.BaseTextCategorizationDataset(20, 0.8)
     self.assertEqual(base.get_index_to_label_map(), {0: 'a', 1: 'b', 2: 'c'})