def test_list_5(self): inputs = (2, 3) embeds = (1, 5, -1, 1) output, embout = utt.shape_dim_fix(inputs, embeds, n_items=4) expect = [1, 2, 3, 1] embexp = [1, 5, 6, 1] self.assertTrue(output == expect, msg=utg.errmsg(output, expect)) self.assertTrue(embout == embexp, msg=utg.errmsg(embout, embexp))
def test_list_2(self): inputs = (2, ) embeds = (-1, ) output, embout = utt.shape_dim_fix(inputs, embeds, n_items=2) expect = [2] embexp = [4] self.assertTrue(output == expect, msg=utg.errmsg(output, expect)) self.assertTrue(embout == embexp, msg=utg.errmsg(embout, embexp))
def test_0(self): inputs = (2, 3) embeds = (1, 0, 0, 1) output, embout = utt.shape_dim_fix(inputs, embeds) expect = [1, 2, 3, 1] embexp = [1, 2, 3, 1] self.assertTrue(output == expect, msg=utg.errmsg(output, expect)) self.assertTrue(embout == embexp, msg=utg.errmsg(embout, embexp))
def test_list(self): inputs = (2, 3) embeds = (-1, 0, 0, [2, 3]) output, embout = utt.shape_dim_fix(inputs, embeds, n_items=5) expect = [1, 1, 2, 3] embexp = [5, 1, 2, 3] self.assertTrue(output == expect, msg=utg.errmsg(output, expect)) self.assertTrue(embout == embexp, msg=utg.errmsg(embout, embexp))
def test_basic(self): inputs = (2, ) embeds = (4, ) output, embout = utt.shape_dim_fix(inputs, embeds) expect = [2] embexp = [4] self.assertTrue(output == expect, msg=utg.errmsg(output, expect)) self.assertTrue(embout == embexp, msg=utg.errmsg(embout, embexp))