<commit_before><commit_msg>test widget link argument validation<commit_after># Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.

import nose.tools as nt

from .. import link, dlink, ToggleButton
from .test_interaction import setup, teardown

def test_link_args():
    with nt.assert_raises(TypeError):
        link()
    w1 = ToggleButton()
    with nt.assert_raises(TypeError):
        link((w1, 'value'))
    
    w2 = ToggleButton()
    link((w1, 'value'), (w2, 'value'))

    with nt.assert_raises(TypeError):
        link((w1, 'value'), (w2, 'nosuchtrait'))

    with nt.assert_raises(TypeError):
        link((w1, 'value'), (w2, 'traits'))

def test_dlink_args():
    with nt.assert_raises(TypeError):
        dlink()
    w1 = ToggleButton()
    with nt.assert_raises(TypeError):
        dlink((w1, 'value'))
    
    w2 = ToggleButton()
    dlink((w1, 'value'), (w2, 'value'))

    with nt.assert_raises(TypeError):
        dlink((w1, 'value'), (w2, 'nosuchtrait'))

    with nt.assert_raises(TypeError):
        dlink((w1, 'value'), (w2, 'traits'))
{'fraction_non_alphanumeric': 0.1491862567811935, 'fraction_numerical': 0.0162748643761302, 'mean_word_length': 3.4457831325301207, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2124332', 'n_tokens_mistral': 396, 'n_tokens_neox': 380, 'n_words': 91}