17361796c4e0cb7bfab5a24b60737645e4cd064d,tests/data/fields/text_field_test.py,TestTextField,test_padding_lengths_are_computed_correctly,#TestTextField#,118

Before Change



    def test_padding_lengths_are_computed_correctly(self):
        field = TextField(["This", "is", "a", "sentence", "."],
                          token_indexers={"words": token_indexers["single id"]("words")})
        field.index(self.vocab)
        padding_lengths = field.get_padding_lengths()
        assert padding_lengths == {"num_tokens": 5}

        field = TextField(["This", "is", "a", "sentence", "."],
                          token_indexers={"characters": token_indexers["characters"]("characters")})
        field.index(self.vocab)
        padding_lengths = field.get_padding_lengths()
        assert padding_lengths == {"num_tokens": 5, "num_token_characters": 8}

        field = TextField(["This", "is", "a", "sentence", "."],
                          token_indexers={"characters": token_indexers["characters"]("characters"),
                                          "words": token_indexers["single id"]("words")})
        field.index(self.vocab)
        padding_lengths = field.get_padding_lengths()
        assert padding_lengths == {"num_tokens": 5, "num_token_characters": 8}

After Change


        assert padding_lengths == {"num_tokens": 5}

        field = TextField(["This", "is", "a", "sentence", "."],
                          token_indexers={"characters": TokenCharactersIndexer("characters")})
        field.index(self.vocab)
        padding_lengths = field.get_padding_lengths()
        assert padding_lengths == {"num_tokens": 5, "num_token_characters": 8}
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 9

Instances


Project Name: allenai/allennlp
Commit Name: 17361796c4e0cb7bfab5a24b60737645e4cd064d
Time: 2017-07-18
Author: mattg@allenai.org
File Name: tests/data/fields/text_field_test.py
Class Name: TestTextField
Method Name: test_padding_lengths_are_computed_correctly


Project Name: allenai/allennlp
Commit Name: 17361796c4e0cb7bfab5a24b60737645e4cd064d
Time: 2017-07-18
Author: mattg@allenai.org
File Name: tests/data/fields/text_field_test.py
Class Name: TestTextField
Method Name: test_padding_lengths_are_computed_correctly


Project Name: allenai/allennlp
Commit Name: 17361796c4e0cb7bfab5a24b60737645e4cd064d
Time: 2017-07-18
Author: mattg@allenai.org
File Name: tests/data/fields/text_field_test.py
Class Name: TestTextField
Method Name: test_field_counts_vocab_items_correctly


Project Name: allenai/allennlp
Commit Name: 17361796c4e0cb7bfab5a24b60737645e4cd064d
Time: 2017-07-18
Author: mattg@allenai.org
File Name: tests/data/fields/text_field_test.py
Class Name: TestTextField
Method Name: test_index_converts_field_correctly