Beispiel #1
0
 def test_append_save(self):
     i1 = MockInfo()
     
     kb.append('a', 'b', i1)
     kb.raw_write('a', 'b', 3)
     
     self.assertEqual(kb.raw_read('a', 'b'), 3)
Beispiel #2
0
 def test_default_first_saved(self):
     kb.raw_write('a', 'b', 'c')
     self.assertEqual(kb.get('a', 'not-exist'), [])
     self.assertEqual(kb.raw_read('a', 'not-exist'), [])
Beispiel #3
0
 def test_default_raw_read(self):
     self.assertEqual(kb.raw_read('a', 'b'), [])
Beispiel #4
0
 def test_basic(self):
     kb.raw_write('a', 'b', 'c')
     data = kb.raw_read('a', 'b')
     self.assertEqual(data, 'c')
Beispiel #5
0
 def test_raw_write_list(self):
     """
     Test for _get_uniq_id which needs to be able to hash any object type.
     """
     kb.raw_write('a', 'b', [1,2,3])
     self.assertEqual(kb.raw_read('a','b'), [1,2,3])
Beispiel #6
0
 def test_overwrite(self):
     kb.raw_write('a', 'b', 'abc')
     kb.raw_write('a', 'b', 'def')
     self.assertEqual(kb.raw_read('a', 'b'), 'def')
Beispiel #7
0
 def test_clear(self):
     kb.raw_write('a', 'b', 'abc')
     kb.raw_write('a', 'c', 'abc')
     kb.clear('a', 'b')
     self.assertEqual(kb.raw_read('a', 'b'), [])
     self.assertEqual(kb.raw_read('a', 'c'), 'abc')
Beispiel #8
0
 def test_raw_write_dict(self):
     kb.raw_write('a', 'b', {})
     self.assertEqual(kb.raw_read('a', 'b'), {})
Beispiel #9
0
 def test_raw_write_dict(self):
     kb.raw_write('a', 'b', {})
     self.assertEqual(kb.raw_read('a', 'b'), {})