def test_not_callable_has_name(): class _(object): __name__ = 'dumb' registrator = register_reaction_mechanism([_()], True) assert raises(InvalidReactionError, registrator, ((lambda x, y: None), ))
def test_add_existing_edge(): a = Molecule({'a1': 'H', 'a2': 'O'}, {'b1': {'nodes': ('a1', 'a2')}}) args = ['b1', {'nodes': ('a1', 'a2')}] function = a._add_edge exception_type = KeyError assert raises(exception_type, function, args)
def test_next_id_invalid(): a = Molecule( {'a1': 'H', 'a2': 'O'}, {'b1': {'nodes': ('a1', 'a2')}} ) assert raises(ValueError, a._next_id, ('c',))
def test_not_callable_has_name(): class _(object): __name__ = 'dumb' registrator = register_reaction_mechanism([_()], True) assert raises(InvalidReactionError, registrator, ((lambda x, y: None),))
def test_register_existing_reaction(): function = register_reaction_mechanism([vacuous], True) def reaction2(*args): pass args = [reaction2] assert raises(ExistingReactionError, function, args)
def test_masking_kwarg(): assert raises(ValueError, Molecule, ({ 'a1': 'H', 'a2': 'O' }, { 'b1': { 'nodes': ('a1', 'a2') } }), {'node': 13})
def test_add_existing_edge(): a = Molecule( {'a1': 'H', 'a2': 'O'}, {'b1': {'nodes': ('a1', 'a2')}} ) args = ['b1', {'nodes': ('a1', 'a2')}] function = a._add_edge exception_type = KeyError assert raises(exception_type, function, args)
def test_register_simple_reaction_with_invalid_requirements(): voodoo = 17 function = register_reaction_mechanism([voodoo], True) def reaction3(reactants, conditions): return 11 args = [reaction3] assert raises(InvalidReactionError, function, args) assert not reaction_is_registered('reaction3', True) assert not reaction_is_registered(reaction3, True)
def test_raises_true(): function = int args = ["hello"] exception_type = ValueError assert raises(exception_type, function, args)
def test_no_requirements_error(): registrator = register_reaction_mechanism([], True) assert raises(InvalidReactionError, registrator, ((lambda x, y: None),))
def test_raises_false(): function = int args = [3] exception_type = ValueError assert not raises(exception_type, function, args)
def test_no_options(self): function = react args = [None, None, True] exception_type = FailedReactionError assert raises(exception_type, function, args)
def test_next_id_invalid(): a = Molecule({'a1': 'H', 'a2': 'O'}, {'b1': {'nodes': ('a1', 'a2')}}) assert raises(ValueError, a._next_id, ('c', ))
def test_no_requirements_error(): registrator = register_reaction_mechanism([], True) assert raises(InvalidReactionError, registrator, ((lambda x, y: None), ))
def test_raises_error(): function = int args = ["hello"] exception_type = UnboundLocalError assert raises(ValueError, raises, (exception_type, function, args))
def test_masking_kwarg(): assert raises(ValueError, Molecule, ( {'a1': 'H', 'a2': 'O'}, {'b1': {'nodes': ('a1', 'a2')}}), {'node': 13} )