Example of how to check some conditions when ALL test suites finished (or enforce some test running at the end of session). This may be useful to ensure that you have tested all functions of some module whose interface can change in future. The code: from pytest import fixture Data = dict ( cnt = 0 ) @fixture ( scope = 'session' ) def data_0 (): yield Data # (this will be done AFTER all tests below) assert Data [ 'cnt' ] == 3 , f 'data-cnt: { Data [ "cnt" ] } ' @fixture def data ( data_0 ): Data [ 'cnt' ] += 1 return Data [ 'cnt' ] def test_11 ( data ): print () print ( 'test-11:' , ...
Working on his theory of inventions Genrich Altshuller invented/discovered so called Laws of technical systems evolution which further were developed by other contributors. Looking at those laws we can see that all of them are in some sense “positive” — i.e. implicitly assume that technical systems always develop from “worse” to “better” only. BUT from my experience I can conclude that the things are not so simple. For example: in 2000ths I used several button-based “stupidphones”. They could do almost nothing except the very basic functions a phone in general is necessary for. And of course it was very unsatisfactory. But when I changed to use “smartphones” I soon was faced with very disappointing obstacle: when I set an alarm on a “stupidphone” and it happens that the device is low on power it still is able to awake next day to activate the alarm and perform ringing even if it turned off due to a complete discharge of the battery before. Very helpfu...
When you formulate any logic predicate you automatically implicitly define a set of entities constrained by that predicate — i.e. a set of items for which the predicate is true. The set appears because predicate ‘works’ on a variable of variables, and variable is something that by definition can have multiple values, thus belongs to some set. So, when you define a predicate P(x) it is the same as to define a set {x| P(x)} and vice versa, union of set is disjunction of correspondent predicates and so on — equivalence between sets and predicates. Russell’s paradox Its original formulation is that a set of sets that don’t contain themselves is contradictory (indeed it can’t neither contain itself nor not contain). But that can be translated into a paradox of logic: Set of sets that don’t contain themselves is a predicate P(Q) = ¬Q(Q) — then P(P) = ¬P(P) — contradiction . _________ ..other articles..
Comments
Post a Comment