def test_accessing_non_existing_key_prints_available_keys(self): blob = Blob() blob['key_a'] = 1 blob['key_b'] = 2 blob.log = MagicMock() with self.assertRaises(KeyError): blob['key_c'] args, kwargs = blob.log.error.call_args_list[0] assert "key_c" in args[0] assert "key_a, key_b" in args[0]
def test_accessing_non_existing_key_raises_keyerror(self): blob = Blob() with self.assertRaises(KeyError): blob['a']
def test_print_empty_blob(self): blob = Blob() assert "Empty blob" == str(blob)
def test_field_can_be_added(self): blob = Blob() blob['foo'] = 1 self.assertEqual(1, blob['foo'])
def test_process(self): blob = Blob() module = Module(name='foo') processed_blob = module.process(blob) self.assertIs(blob, processed_blob)
def process(self, blob): return Blob({'a': 1, 'b': 2, 'c': 3})