MCPcopy Create free account
hub / github.com/ipython/traitlets / test_validate_used

Method test_validate_used

tests/test_traitlets.py:2008–2023  ·  view source on GitHub ↗

Verify that the validate value is being used

(self)

Source from the content-addressed store, hash-verified

2006 u.even = 3 # Trait Error
2007
2008 def test_validate_used(self):
2009 """Verify that the validate value is being used"""
2010
2011 class FixedValue(HasTraits):
2012 value = Int(0)
2013
2014 @validate("value")
2015 def _value_validate(self, proposal):
2016 return -1
2017
2018 u = FixedValue(value=2)
2019 assert u.value == -1
2020
2021 u = FixedValue()
2022 u.value = 3
2023 assert u.value == -1
2024
2025
2026class TestLink(TestCase):

Callers

nothing calls this directly

Calls 1

FixedValueClass · 0.85

Tested by

no test coverage detected