Beispiel #1
0
 def test_process_remove(self):
     data = {'id': 1, 'title': 'One', 'baz': {'id': 1}}
     norm = Normalize()
     norm.define_primary('foo')
     norm.remove_flds('foo', 'title')
     norm.remove_flds('foo', 'asdf')
     self.assertEqual(norm._process_data_changes('foo', data), {
         'baz': {
             'id': 1
         },
         'id': 1
     })
Beispiel #2
0
 def test_remove_flds(self):
     norm = Normalize()
     norm.define_primary('foo')
     norm.remove_flds('foo', 'title')
     self.assertEqual(norm.parse([{
         'id': 1,
         'title': 'One'
     }]), {
         'entities': {
             'foo': {
                 1: {
                     'id': 1
                 }
             }
         },
         'results': [1]
     })