示例#1
0
 def delta(self, other):
     '''return the difference between the data'''
     if hasattr(other, 'data'):
         data = other.data
     else:
         data = other
     diffs = [
         namespace.locate_ns_item(self.data, key, building=True) for key in \
         filter( \
             lambda key: namespace.locate_ns_item(data, key) != namespace.locate_ns_item(self.data, key), \
                  [key for key in self.relevant_data_keys if namespace.in_ns(self.data, key)]
         ) \
     ]
     delta = namespace.Namespace()
     for diff in diffs:
         delta.update(diff)
     return delta
示例#2
0
 def delta(self, other):
     """return the difference between the data"""
     if hasattr(other, "data"):
         data = other.data
     else:
         data = other
     diffs = [
         namespace.locate_ns_item(self.data, key, building=True)
         for key in filter(
             lambda key: namespace.locate_ns_item(data, key) != namespace.locate_ns_item(self.data, key),
             [key for key in self.relevant_data_keys if namespace.in_ns(self.data, key)],
         )
     ]
     delta = namespace.Namespace()
     for diff in diffs:
         delta.update(diff)
     return delta
示例#3
0
 def assert_data(self, data):
     for key in self.required_data_keys:
         assert namespace.in_ns(data, key) and namespace.locate_ns_item(data, key) is not None, \
             "no %s key in data %s" % (key, data)
示例#4
0
 def assert_data(self, data):
     for key in self.required_data_keys:
         assert (
             namespace.in_ns(data, key) and namespace.locate_ns_item(data, key) is not None
         ), "no %s key in data %s" % (key, data)