Пример #1
0
    def test__clear(self):

        logging.info('***** _clear')

        store = Store()

        with self.assertRaises(NotImplementedError):
            store._clear('sca.lar')
Пример #2
0
    def test__set(self):

        logging.info('***** _set')

        store = Store()

        with self.assertRaises(NotImplementedError):
            store._set('sca.lar', 'test')
Пример #3
0
    def test_init(self):

        logging.info('***** init')

        store = Store()
        self.assertEqual(store.context, None)
        self.assertTrue(store.lock is not None)

        store = Store(context=self.context)
        self.assertEqual(store.context, self.context)
Пример #4
0
    def test_to_text(self):

        logging.info('***** to_text')

        store = Store()

        self.assertEqual(store.to_text('text'), '"text"')

        self.assertEqual(store.to_text(['hello', 'world']),
                         '["hello", "world"]')

        self.assertEqual(store.to_text({'hello': 'world'}),
                         '{"hello": "world"}')
Пример #5
0
    def test_from_text(self):

        logging.info('***** from_text')

        store = Store()

        value = 'text'
        self.assertEqual(store.from_text(store.to_text(value)), value)

        value = ['hello', 'world', 123, 4.56, ['another', 'list']]
        self.assertEqual(store.from_text(store.to_text(value)), value)

        value = {'hello': 'world'}
        self.assertEqual(store.from_text(store.to_text(value)), value)
Пример #6
0
    def test_bond(self):

        logging.info('***** bond')

        store = Store(context=self.context)
        store.bond()

        store.bond(id='*123')
Пример #7
0
    def test_check(self):

        logging.info('***** check')

        store = Store(context=self.context)
        store.check()