Exemplo n.º 1
0
 def __init__(self, *args, **kw):
   self._init_schema_data()
   for arg in args:
     if not isinstance(arg, Mapping):
       raise ValueError('Expected dictionary argument, got %s' % repr(arg))
     self._update_schema_data(**arg)
   self._update_schema_data(**copy.copy(kw))
   Object.__init__(self)
Exemplo n.º 2
0
    def __init__(self, *args):
        """
      Construct a map.

      Input:
        sequence of tuples _or_ a dictionary
    """
        if len(args) == 1 and isinstance(args[0], Mapping):
            self._map = self._coerce_map(copy.copy(args[0]))
        elif all(isinstance(arg, Iterable) and len(arg) == 2 for arg in args):
            self._map = self._coerce_tuple(args)
        else:
            raise ValueError("Unexpected input to MapContainer: %s" % repr(args))
        Object.__init__(self)
Exemplo n.º 3
0
def test_object_unimplementeds():
  o = Object()
  with pytest.raises(NotImplementedError):
    Object.checker(o)
  with pytest.raises(NotImplementedError):
    o.get()
  with pytest.raises(NotImplementedError):
    oi = o.interpolate()
Exemplo n.º 4
0
def test_object_unimplementeds():
  o = Object()
  with pytest.raises(NotImplementedError):
    Object.checker(o)
  with pytest.raises(NotImplementedError):
    o.get()
  with pytest.raises(NotImplementedError):
    oc = o.copy()
  with pytest.raises(NotImplementedError):
    oi = o.interpolate()
Exemplo n.º 5
0
 def __init__(self, vals):
     self._values = self._coerce_values(copy.copy(vals))
     Object.__init__(self)
Exemplo n.º 6
0
 def __init__(self, value):
   self._value = value
   Object.__init__(self)