# Path: tacl/exceptions.py
# class MalformedCatalogueError(TACLError):
# 
#     pass


import os.path
import tempfile
import unittest
import tacl
from tacl.exceptions import MalformedCatalogueError
            'label3': 'label2',
        }
        relabelled_catalogue = catalogue.relabel(relabelling)
        self.assertEqual(relabelled_catalogue['T0123'], 'label3')
        self.assertEqual(relabelled_catalogue['T3210'], 'label3')
        self.assertEqual(relabelled_catalogue['T2301'], 'label1')
        self.assertEqual(relabelled_catalogue['T1230'], 'label2')
        self.assertNotIn('T3012', relabelled_catalogue)
        self.assertNotIn('T1234', relabelled_catalogue)
        self.assertNotIn('T2341', relabelled_catalogue)
        relabelled_catalogue = catalogue.relabel(relabelling)
        self.assertEqual(relabelled_catalogue['T0123'], 'label3')
        self.assertEqual(relabelled_catalogue['T3210'], 'label3')
        self.assertEqual(relabelled_catalogue['T2301'], 'label1')
        self.assertEqual(relabelled_catalogue['T1230'], 'label2')
        self.assertNotIn('T3012', relabelled_catalogue)
        self.assertNotIn('T1234', relabelled_catalogue)
        self.assertNotIn('T2341', relabelled_catalogue)

    def test_ordered_labels_remove(self):
        catalogue = tacl.Catalogue()
        catalogue.load(os.path.join(self._data_dir, 'catalogue2.txt'))
        catalogue.remove_label('C')
        self.assertEqual(catalogue.ordered_labels, ['B', 'A'])

    def test_save(self):
        catalogue = tacl.Catalogue()
        catalogue['T2102-辯惑論序'] = 'label1'
        catalogue['T2102-通直郎庾黔婁答'] = 'label2'
        catalogue['T2102-遠法師答'] = 'label1'

# Path: tacl/exceptions.py
# class MalformedCatalogueError(TACLError):
# 
#     pass


# Path: tests/integration_tests/catalogue_test.py
import os.path
import tempfile
import unittest
import tacl
from tacl.exceptions import MalformedCatalogueError

            'label3': 'label2',
        }
        relabelled_catalogue = catalogue.relabel(relabelling)
        self.assertEqual(relabelled_catalogue['T0123'], 'label3')
        self.assertEqual(relabelled_catalogue['T3210'], 'label3')
        self.assertEqual(relabelled_catalogue['T2301'], 'label1')
        self.assertEqual(relabelled_catalogue['T1230'], 'label2')
        self.assertNotIn('T3012', relabelled_catalogue)
        self.assertNotIn('T1234', relabelled_catalogue)
        self.assertNotIn('T2341', relabelled_catalogue)
        relabelled_catalogue = catalogue.relabel(relabelling)
        self.assertEqual(relabelled_catalogue['T0123'], 'label3')
        self.assertEqual(relabelled_catalogue['T3210'], 'label3')
        self.assertEqual(relabelled_catalogue['T2301'], 'label1')
        self.assertEqual(relabelled_catalogue['T1230'], 'label2')
        self.assertNotIn('T3012', relabelled_catalogue)
        self.assertNotIn('T1234', relabelled_catalogue)
        self.assertNotIn('T2341', relabelled_catalogue)

    def test_ordered_labels_remove(self):
        catalogue = tacl.Catalogue()
        catalogue.load(os.path.join(self._data_dir, 'catalogue2.txt'))
        catalogue.remove_label('C')
        self.assertEqual(catalogue.ordered_labels, ['B', 'A'])

    def test_save(self):
        catalogue = tacl.Catalogue()
        catalogue['T2102-辯惑論序'] = 'label1'
        catalogue['T2102-通直郎庾黔婁答'] = 'label2'
        catalogue['T2102-遠法師答'] = 'label1'

        with tempfile.TemporaryDirectory() as tmp_dir: