Exemplo n.º 1
0
    def test_from_document(self):
        processor1 = PreProcessor.from_document(
            {'classname': 'test.processorclass'})
        self.assertIsNotNone(processor1)
        self.assertIsNone(processor1.id)
        self.assertEqual("test.processorclass", processor1.classname)

        processor2 = PreProcessor.from_document({
            '_id':
            '666',
            'classname':
            'test.processorclass'
        })
        self.assertIsNotNone(processor2)
        self.assertIsNotNone(processor2.id)
        self.assertEqual('666', processor2.id)
        self.assertEqual("test.processorclass", processor2.classname)
Exemplo n.º 2
0
 def test_repr_no_id(self):
     processor1 = PreProcessor.from_document({'classname': 'test.processorclass'})
     self.assertEquals("<PreProcessor(id='n/a', classname='test.processorclass')>", str(processor1))
Exemplo n.º 3
0
 def test_repr_with_id(self):
     processor2 = PreProcessor.from_document({'_id': '666', 'classname': 'test.processorclass'})
     self.assertEquals("<PreProcessor(id='666', classname='test.processorclass')>", str(processor2))
Exemplo n.º 4
0
 def test_from_document_no_id(self):
     processor1 = PreProcessor.from_document({'classname': 'test.processorclass'})
     self.assertIsNotNone(processor1)
     self.assertIsNone(processor1.id)
     self.assertEqual("test.processorclass", processor1.classname)