scrapi.base.helpers.CONSTANT

Here are the examples of the python api scrapi.base.helpers.CONSTANT taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: scrapi Source File: test_transformer.py
    def test_constants(self):
        self.harvester.schema = updated_schema(
            TEST_SCHEMA, {
                'tags': (CONSTANT(['X']), lambda x: x),
                'otherProperties': [{
                    'name': CONSTANT('test'),
                    'properties': {
                        'test':  CONSTANT('test')
                    },
                    'uri': CONSTANT('http://example.com'),
                    'description': CONSTANT('A test field')
                }]
            }
        )
        results = [
            self.harvester.normalize(record) for record in self.harvester.harvest(days_back=1)
        ]

        for result in results:
            assert result['otherProperties'][0]['properties']['test'] == 'test'
            assert result['tags'] == ['X']