def test_set(): setknob = Knob('KNOB_NAME', 'KNOB_VAL') assert setknob.get_type() == str assert setknob.get() == 'KNOB_VAL' setknob.set('XX123') assert setknob.get() == 'XX123'
def test_knob_cast_str_auto_corrected_to_int(): knob = Knob('WUNDER', 22) assert knob.get() == 22
def test_cast_to_int(): pirate_count = Knob('JOLLY_ROGER_PIRATES', 124, description='Yar') assert pirate_count.get() == 124 assert pirate_count.description == 'Yar'
def test_knob(): knob = Knob('WUNDER', 'BAR', description='Foo Bar') assert knob() == 'BAR' assert knob.get() == 'BAR' assert knob.description == 'Foo Bar' knob.rm()