Example #1
0
    def test_filter_keys(self):
        """Tests the utils.filter_keys function"""

        self.assertEqual(
            {'a': 1, 'b': 2},
            utils.filter_keys({'a': 1, 'b': 2, 'c': 3}, 'a', 'b')
        )
        self.assertEqual(
            {},
            utils.filter_keys({'a': 1, 'b': 2, 'c': 3}, 'd', 'e')
        )
Example #2
0
 def from_json(d):
     return Column(
         **from_json(
             filter_keys(
                 d,
                 'name', 'tablename', 'type', 'nullable', 'default',
                 'autoincrement', 'primary_key', 'autocomplete'
             )
         )
     )
Example #3
0
 def from_json(d):
     return Table(
         **from_json(
             filter_keys(
                 d,
                 'name', 'uri', 'owner', 'size', 'primary_key', 'columns',
                 'foreign_keys', 'autocomplete'
             )
         )
     )
Example #4
0
 def from_json(d):
     return Row(
         **from_json(filter_keys(d, 'table', 'row', 'autocomplete'))
     )
Example #5
0
 def from_json(d):
     return Row(**from_json(filter_keys(d, 'table', 'row', 'autocomplete')))
Example #6
0
 def from_json(d):
     return Table(**from_json(
         filter_keys(d, 'name', 'uri', 'owner', 'size', 'primary_key',
                     'columns', 'foreign_keys', 'autocomplete')))