Best Python code snippet using pytest
functions_calculus.py
Source:functions_calculus.py
...3config.globals=globals()4isimplies_itself=basic_function(config,5 name='isimplies_itself',6 desc='x is a sequence of the form formula formula',7 define='lambda x: and_f3(issequence(x),equal(slength(x),n2),equal(sitem(n1,x),sitem(n2,x)))'8)9istautologicalequation=basic_function(config,10 name='istautologicalequation',11 desc='x is a sequence of the form term = term',12 define='lambda x: and_f4(issequence(x),equal(slength(x),n1),isequation(sitem(n1,x)),equal(equation_term1(sitem(n1,x)),equation_term2(sitem(n1,x))))'13)14isintroductionofconjunction=basic_function(config,15 name='isintroductionofconjunction',16 desc='x is a sequence ... a, y is a sequence --- b, z is ... --- ( a & b )',17 define='lambda x,y,z: and_f7(issequence(x),issequence(y),issequence(z),isconjunction(sequence_end(z)),sequal(sequence_start(z),concat(sequence_start(x),sequence_start(y))),equal(conjunction_formula1(sequence_end(z)),sequence_end(x)),equal(conjunction_formula2(sequence_end(z)),sequence_end(y)))'18)19isdeletionofconjunction1=basic_function(config,20 name='isdeletionofconjunction1',21 desc='x is a sequence ... ( a & b ), y is a sequence ... a',22 define='lambda x,y: and_f4(issequence(x),isconjunction(sequence_end(x)),sequal(sequence_start(x),sequence_start(y)),equal(sequence_end(y),conjunction_formula1(sequence_end(x))))'23)24isdeletionofconjunction2=basic_function(config,25 name='isdeletionofconjunction2',26 desc='x is a sequence ... ( a & b ), y is a sequence ... b',27 define='lambda x,y: and_f4(issequence(x),isconjunction(sequence_end(x)),sequal(sequence_start(x),sequence_start(y)),equal(sequence_end(y),conjunction_formula2(sequence_end(x))))'28)29isexhaustion=basic_function(config,30 name='isexhaustion',31 desc='x is a sequence ... a b, y is a sequence --- ~a b, z is a sequence ... --- b',32 define='lambda x,y,z: and_f10(issequence(x),issequence(y),issequence(z),smaller(n1,slength(x)),smaller(n1,slength(y)),isnegation(sitem(acfull(slength(y)),y)),equal(negation_formula(sitem(acfull(slength(y)),y)),sitem(acfull(slength(x)),x)),equal(sequence_end(x),sequence_end(y)),equal(sequence_end(x),sequence_end(z)),sequal(sequence_start(z),concat(sequence_start(sequence_start(x)),sequence_start(sequence_start(y)))))'33)34isquodlibet=basic_function(config,35 name='isquodlibet',36 desc='x is a sequence ... a, y is a sequence --- ~a, z is a sequence ... --- b',37 define='lambda x,y,z: and_f6(issequence(x),issequence(y),issequence(z),isnegation(sequence_end(y)),equal(negation_formula(sequence_end(y)),sequence_end(x)),sequal(sequence_start(z),concat(sequence_start(x),sequence_start(y))))'38)39isremovalofgeneralization=basic_function(config,40 name='isremovalofgeneralization',41 desc='x is a sequence ... !x:a, y is a sequence ... a',42 define='lambda x,y: and_f5(issequence(x),issequence(y),isgeneralization(sequence_end(x)),sequal(sequence_start(x),sequence_start(y)),equal(generalization_formula(sequence_end(x)),sequence_end(y)))'43)44isintroductionofgeneralization=basic_function(config,45 name='isintroductionofgeneralization',46 desc='x is a sequence ... a, y is a sequence ... !x:a, x is not free in ...',47 define='lambda x,y: and_f6(issequence(x),issequence(y),isgeneralization(sequence_end(y)),sequal(sequence_start(x),sequence_start(y)),equal(sequence_end(x),generalization_formula(sequence_end(y))),or_f(zero(sequence_start(x)),not_f(freeinsequence(sequence_start(x),generalization_namelc(sequence_end(y))))))'48)49issubstitution=basic_function(config,50 name='issubstitution',51 desc='x is a sequence, y is a sequence, y is a substitution of a term in y for a variable in x in x',52 define='lambda x,y: and_f4(issequence(x),issequence(y),not_f(equal(x,y)),subst_sequence_any(x,y))'53)54issubstitutionwithidentity=basic_function(config,55 name='issubstitutionwithidentity',56 desc='x is a sequence ... a, y is a sequence --- x=t b, b is a substitution of t for x in a',57 define='lambda x,y: and_f5(issequence(x),issequence(y),smaller(n1,slength(y)),isequation(sequence_end(sequence_start(y))),equal(sequence_end(y),subst_formula(sequence_end(x),equation_term1(sequence_end(sequence_start(y))),equation_term2(sequence_end(sequence_start(y))))))'58)59ispermutation=basic_function(config,60 name='ispermutation',61 desc='x is a sequence ... a, y is a sequence ... a',62 define='lambda x,y: and_f5(issequence(x),issequence(y),smaller(n2,slength(x)),equal(sequence_end(x),sequence_end(y)),sequal(sequence_start(x),sequence_start(y)))'...
test_misc.py
Source:test_misc.py
...50 self.assertTrue(isinteger(numpy.int_(1.0)))51 self.assertFalse(isinteger(1.0))52 self.assertFalse(isinteger('1'))53 self.assertFalse(isinteger(True))54 def test_issequence(self):55 issequence = lib.issequence56 self.assertTrue(issequence([1, 2, 3]))57 self.assertTrue(issequence(numpy.array([1, 2, 3])))58 self.assertTrue(issequence(range(5)))59 self.assertTrue(issequence('abcde'))60 self.assertTrue(issequence(tuple()))61 self.assertFalse(issequence(True))62 self.assertFalse(issequence(2.0))63 self.assertFalse(issequence(1))64 self.assertFalse(issequence(dict()))65 self.assertFalse(issequence(set()))66 def test_isintsequence(self):67 isintsequence = lib.isintsequence68 self.assertTrue(isintsequence([2, 4, 6]))69 self.assertTrue(isintsequence(numpy.array([2, 4, 6])))70 self.assertTrue(isintsequence([]))71 self.assertFalse(isintsequence([2.0, 4.0, 6.0]))72 self.assertFalse(isintsequence(numpy.array([2.0, 4.0, 6.0])))73 self.assertFalse(isintsequence((True, False)))74 self.assertFalse(isintsequence('123'))75 self.assertFalse(isintsequence(5))76if __name__ == "__main__":...
test_sputils.py
Source:test_sputils.py
...37 assert_equal(sputils.isshape( (5,2) ),True)38 assert_equal(sputils.isshape( (1.5,2) ),False)39 assert_equal(sputils.isshape( (2,2,2) ),False)40 assert_equal(sputils.isshape( ([2],2) ),False)41 def test_issequence(self):42 assert_equal(sputils.issequence( (1,) ),True)43 assert_equal(sputils.issequence( (1,2,3) ),True)44 assert_equal(sputils.issequence( [1] ),True)45 assert_equal(sputils.issequence( [1,2,3] ),True)46 assert_equal(sputils.issequence( np.array([1,2,3]) ),True)47 assert_equal(sputils.issequence( np.array([[1],[2],[3]]) ),False)48 assert_equal(sputils.issequence( 3 ),False)49 def test_isdense(self):50 assert_equal(sputils.isdense( np.array([1]) ),True)51 assert_equal(sputils.isdense( np.matrix([1]) ),True)52if __name__ == "__main__":...
__init__.py
Source:__init__.py
1"""Matchers of collections."""2from .is_empty import empty3from .isdict_containing import has_entry4from .isdict_containingentries import has_entries5from .isdict_containingkey import has_key6from .isdict_containingvalue import has_value7from .isin import is_in8from .issequence_containing import has_item, has_items9from .issequence_containinginanyorder import contains_inanyorder10from .issequence_containinginorder import contains, contains_exactly11from .issequence_onlycontaining import only_contains12__author__ = "Chris Rose"13__copyright__ = "Copyright 2013 hamcrest.org"...
Looking for an in-depth tutorial around pytest? LambdaTest covers the detailed pytest tutorial that has everything related to the pytest, from setting up the pytest framework to automation testing. Delve deeper into pytest testing by exploring advanced use cases like parallel testing, pytest fixtures, parameterization, executing multiple test cases from a single file, and more.
Skim our below pytest tutorial playlist to get started with automation testing using the pytest framework.
https://www.youtube.com/playlist?list=PLZMWkkQEwOPlcGgDmHl8KkXKeLF83XlrP
Get 100 minutes of automation test minutes FREE!!