Exemplo n.º 1
0
    def test_immutable(self):
        p = Property()
        assert p is not p.replace(**p.to_dict())

        for attrname in self.attributes:
            try:
                setattr(p, attrname, None)
            except AttributeError:
                pass
            else:
                assert False, 'must not be able to change %r ' % (attrname, )
Exemplo n.º 2
0
    def test_immutable(self):
        p = Property()
        assert p is not p.replace(**p.to_dict())

        for attrname in self.attributes:
            try:
                setattr(p, attrname, None)
            except AttributeError:
                pass
            else:
                assert False, 'must not be able to change %r ' % (attrname,)
Exemplo n.º 3
0
    def test_replace_value(self):
        p = Property(value='original')

        assert 'new' == p.replace(value='new').value
        assert 'original' == p.replace(value=None).value
Exemplo n.º 4
0
    def test_replace_without_values(self):
        p = Property('a', 5, int, '\d+', False, False, 'doc')

        assert p == p.replace()
        assert p == p.replace(**dict.fromkeys(self.attributes))
Exemplo n.º 5
0
    def test_replace_value(self):
        p = Property(value='original')

        assert 'new' == p.replace(value='new').value
        assert 'original' == p.replace(value=None).value
Exemplo n.º 6
0
    def test_replace_without_values(self):
        p = Property('a', 5, int, '\d+', False, False, 'doc')

        assert p == p.replace()
        assert p == p.replace(**dict.fromkeys(self.attributes))