MCPcopy Create free account
hub / github.com/PAIR-code/lit / test_remap

Method test_remap

lit_nlp/api/dataset_test.py:77–92  ·  view source on GitHub ↗

Test remap method.

(self)

Source from the content-addressed store, hash-verified

75 self.assertIsNone(dataset.init_spec())
76
77 def test_remap(self):
78 """Test remap method."""
79 spec = {
80 'score': lit_types.Scalar(),
81 'text': lit_types.TextSegment(),
82 }
83 datapoints = [
84 {'score': 0, 'text': 'a'},
85 {'score': 0, 'text': 'b'},
86 ]
87 dset = lit_dataset.Dataset(spec, datapoints)
88 remap_dict = {'score': 'val', 'nothing': 'nada'}
89 remapped_dset = dset.remap(remap_dict)
90 self.assertIn('val', remapped_dset.spec())
91 self.assertNotIn('score', remapped_dset.spec())
92 self.assertEqual({'val': 0, 'text': 'a'}, remapped_dset.examples[0])
93
94
95class InputHashTest(parameterized.TestCase):

Callers

nothing calls this directly

Calls 2

remapMethod · 0.95
specMethod · 0.45

Tested by

no test coverage detected