Esempio n. 1
0
    def test_extract_with_prefix(self):
        decl = PostGenerationDeclaration(extract_prefix='blah')

        extracted, kwargs = decl.extract('foo',
            {'foo': 13, 'foo__bar': 42, 'blah': 42, 'blah__baz': 1})
        self.assertEqual(extracted, 42)
        self.assertEqual(kwargs, {'baz': 1})
Esempio n. 2
0
    def test_extract_with_prefix(self):
        decl = PostGenerationDeclaration(extract_prefix='blah')

        extracted, kwargs = decl.extract('foo', {
            'foo': 13,
            'foo__bar': 42,
            'blah': 42,
            'blah__baz': 1
        })
        self.assertEqual(extracted, 42)
        self.assertEqual(kwargs, {'baz': 1})
Esempio n. 3
0
    def test_extract_no_prefix(self):
        decl = PostGenerationDeclaration()

        extracted, kwargs = decl.extract('foo', {'foo': 13, 'foo__bar': 42})
        self.assertEqual(extracted, 13)
        self.assertEqual(kwargs, {'bar': 42})
Esempio n. 4
0
    def test_extract_no_prefix(self):
        decl = PostGenerationDeclaration()

        extracted, kwargs = decl.extract('foo', {'foo': 13, 'foo__bar': 42})
        self.assertEqual(extracted, 13)
        self.assertEqual(kwargs, {'bar': 42})