Exemple #1
0
    def test_label_dict_mutations_are_not_stored(self):
        jar = LabelJar(self.root)
        label_id = jar.add('Question', '#FF0000')

        label = jar.get(label_id)
        label['title'] = 'HACK THE TITLE'

        self.assertDictEqual({'label_id': label_id,
                              'title': 'Question',
                              'color': '#FF0000'},
                             jar.get(label_id))
Exemple #2
0
    def test_label_dict_mutations_are_not_stored(self):
        jar = LabelJar(self.root)
        label_id = jar.add('Question', '#FF0000', False)

        label = jar.get(label_id)
        label['title'] = 'HACK THE TITLE'

        self.assertDictEqual(
            {
                'label_id': label_id,
                'title': 'Question',
                'color': '#FF0000',
                'by_user': False
            }, jar.get(label_id))
Exemple #3
0
    def test_updating_labels(self):
        jar = LabelJar(self.root)

        label_id = jar.add('Question', '#FF0000')
        self.assertDictEqual({'label_id': label_id,
                              'title': 'Question',
                              'color': '#FF0000'},
                             jar.get(label_id))

        jar.update(label_id, 'New Question', '#0000FF')
        self.assertDictEqual({'label_id': label_id,
                              'title': 'New Question',
                              'color': '#0000FF'},
                             jar.get(label_id))
Exemple #4
0
    def test_adding_new_label(self):
        jar = LabelJar(self.root)
        label_id = jar.add('Question', '#FF0000')

        self.assertDictEqual({'label_id': label_id,
                              'title': 'Question',
                              'color': '#FF0000'},
                             jar.get(label_id))
Exemple #5
0
    def test_updating_labels(self):
        jar = LabelJar(self.root)

        label_id = jar.add('Question', '#FF0000', False)
        self.assertDictEqual(
            {
                'label_id': label_id,
                'title': 'Question',
                'color': '#FF0000',
                'by_user': False
            }, jar.get(label_id))

        jar.update(label_id, 'New Question', '#0000FF', True)
        self.assertDictEqual(
            {
                'label_id': label_id,
                'title': 'New Question',
                'color': '#0000FF',
                'by_user': True
            }, jar.get(label_id))
Exemple #6
0
    def test_adding_new_label(self):
        jar = LabelJar(self.root)
        label_id = jar.add('Question', '#FF0000', False)

        self.assertDictEqual(
            {
                'label_id': label_id,
                'title': 'Question',
                'color': '#FF0000',
                'by_user': False
            }, jar.get(label_id))