def test_representations(): view = nv.show_pytraj(pt.datafiles.load_tz2()) view.representations = DEFAULT_REPR view.add_cartoon() representations_2 = DEFAULT_REPR[:] representations_2.append({'type': 'cartoon', 'params': {'sele': 'all'}}) _assert_dict_list_equal(view.representations, representations_2) # accept dict too (to specify seperate reprs for different component def func(): view.representations = {'0': MagicMock()} assert view._dry_run( func)['methodName'] == '_set_representation_from_repr_dict' # Representations # make fake params try: view._ngl_repr_dict = {'c0': {'0': {'parameters': {}}}} except (KeyError, TraitError): # in real application, we are not allowed to assign values pass view._ngl_repr_dict = REPR_DICT representation_widget = RepresentationControl(view, 0, 0) representation_widget representation_widget._on_parameters_changed(change=dict(new=dict()))
def test_representations(): view = nv.show_pytraj(pt.datafiles.load_tz2()) assert view.representations == DEFAULT_REPR view.add_cartoon() representations_2 = DEFAULT_REPR[:] representations_2.append({'type': 'cartoon', 'params': {'sele': 'all'}}) _assert_dict_list_equal(view.representations, representations_2) # Representations # make fake params try: view._repr_dict = {'c0': {'0': {'parameters': {}}}} except (KeyError, TraitError): # in real application, we are not allowed to assign values pass view._repr_dict = REPR_DICT representation_widget = RepresentationControl(view, 0, 0) representation_widget representation_widget._on_parameters_changed(change=dict(new=dict()))