def test_preserves_order(self):
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.append('three', 'tres')
        fields.append('two', 'dois')

        self.assertEqual([
            'one: um',
            'three: tres',
            'two: dois',
        ],
                         fields.makeOutput().splitlines())
    def test_preserves_order(self):
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.append('three', 'tres')
        fields.append('two', 'dois')

        self.assertEqual(
            ['one: um', 'three: tres', 'two: dois',
             ], fields.makeOutput().splitlines())
    def test_simple(self):
        fields = IndexStanzaFields()
        fields.append('breakfast', 'coffee')
        fields.append('lunch', 'beef')
        fields.append('dinner', 'fish')

        self.assertEqual(3, len(fields.fields))
        self.assertTrue(('dinner', 'fish') in fields.fields)
        self.assertEqual([
            'breakfast: coffee',
            'lunch: beef',
            'dinner: fish',
        ],
                         fields.makeOutput().splitlines())
    def test_simple(self):
        fields = IndexStanzaFields()
        fields.append('breakfast', 'coffee')
        fields.append('lunch', 'beef')
        fields.append('dinner', 'fish')

        self.assertEqual(3, len(fields.fields))
        self.assertTrue(('dinner', 'fish') in fields.fields)
        self.assertEqual(
            ['breakfast: coffee', 'lunch: beef', 'dinner: fish',
             ], fields.makeOutput().splitlines())
    def test_files(self):
        # Special treatment for field named 'Files'
        # do not add a space between <name>:<value>
        # <value> will always start with a new line.
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.append('Files', '<no_sep>')

        self.assertEqual(['one: um', 'Files:<no_sep>'],
                         fields.makeOutput().splitlines())
    def test_extend(self):
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.extend([('three', 'tres'), ['four', 'five']])

        self.assertEqual([
            'one: um',
            'three: tres',
            'four: five',
        ],
                         fields.makeOutput().splitlines())
    def test_extend(self):
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.extend([('three', 'tres'), ['four', 'five']])

        self.assertEqual(
            ['one: um', 'three: tres', 'four: five',
             ], fields.makeOutput().splitlines())
    def test_files(self):
        # Special treatment for field named 'Files'
        # do not add a space between <name>:<value>
        # <value> will always start with a new line.
        fields = IndexStanzaFields()
        fields.append('one', 'um')
        fields.append('Files', '<no_sep>')

        self.assertEqual(
            ['one: um', 'Files:<no_sep>'], fields.makeOutput().splitlines())