e9\ddlmZmZmZmZmZmZmZddlm Z ddl m Z ddl m Z ddlmZdZdZdZed e Zed ZGd d e eeefZedeeeefdeeeeffdZedeeeeeeffdeeeeffdZededeeeeffdZdZy))AnyHashableMappingOptionalTypeVarUnionoverload) BaseMatcher) Description) wrap_matcher)MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtK)boundVceZdZddZdeeefdeede fdZ ddeeefdeede fdZ deeefdeddfdZ d ed ed eddfd Z d eddfd Zy)IsDictContainingEntriesreturnNc@t|j|_yN)sorteditemsvalue_matchers)selfrs V/usr/lib/python3/dist-packages/hamcrest/library/collection/isdict_containingentries.py__init__z IsDictContainingEntries.__init__s$^%9%9%;<itemmismatch_descriptioncH|r |j|jdy)Nz is not a mapping objectFappend_description_of append_textrrrs r_not_a_dictionaryz)IsDictContainingEntries._not_a_dictionarys$ 6 6t < H HIc drc|jD]\}} ||vrB|r>|jdj|jdj|y ||}|j |rf|rA|jdj|jd|j ||yy#t$r|j ||cYcSwxYw#t$r|j ||cYcSwxYw)Nzno z key in Fz value for  T)rr"r! TypeErrorr$matchesdescribe_mismatch)rrrkey value_matcher actual_values rr(zIsDictContainingEntries.matchess#'"5"5  C Jd?+,88?UU%+j12G2G2M # J#Cy !((6'(44\BXX!k#&!33LBVW- 0! J--d4HII J  J--d4HII Js$AB:C:CCC=<C=c(|j||yr)r(r#s rr)z)IsDictContainingEntries.describe_mismatch8s T/0rindexvalue descriptioncb|j|jdj|y)z(Describes key-value pair at given index.z: Nr )rr.r/r0s rdescribe_keyvaluez)IsDictContainingEntries.describe_keyvalue;s'))%0<s rr?r?Qr@rcyrr;r>s rr?r?Wr@rct|dk(r- |dj}|D]}t||||<n]t|dzr t di}t t t|dz D]}t|d|zdz||d|z<!|jD]\}}t|||<t|S#t$r t dwxYw)a%Matches if dictionary contains entries satisfying a dictionary of keys and corresponding value matchers. :param matcher_dict: A dictionary mapping keys to associated value matchers, or to expected values for :py:func:`~hamcrest.core.core.isequal.equal_to` matching. Note that the keys must be actual keys, not matchers. Any value argument that is not a matcher is implicitly wrapped in an :py:func:`~hamcrest.core.core.isequal.equal_to` matcher to check for equality. Examples:: has_entries({'foo':equal_to(1), 'bar':equal_to(2)}) has_entries({'foo':1, 'bar':2}) ``has_entries`` also accepts a list of keyword arguments: .. function:: has_entries(keyword1=value_matcher1[, keyword2=value_matcher2[, ...]]) :param keyword1: A keyword to look up. :param valueMatcher1: The matcher to satisfy for the value, or an expected value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching. Examples:: has_entries(foo=equal_to(1), bar=equal_to(2)) has_entries(foo=1, bar=2) Finally, ``has_entries`` also accepts a list of alternating keys and their value matchers: .. function:: has_entries(key1, value_matcher1[, ...]) :param key1: A key (not a matcher) to look up. :param valueMatcher1: The matcher to satisfy for the value, or an expected value for :py:func:`~hamcrest.core.core.isequal.equal_to` matching. Examples:: has_entries('foo', equal_to(1), 'bar', equal_to(2)) has_entries('foo', 1, 'bar', 2) rzEsingle-argument calls to has_entries must pass a dict as the argumentz$has_entries requires key-value pairs) lencopyr AttributeError ValueErrorrangeintrr)r<kv_args base_dictr*r.r/s rr?r?\s\ !# *1-224I  >!-in!= # > ! "Q &CD D 3s#56:;< E7C"1u9q=18I(U3 4  mmo- U%e, #- #9 --! W  s +C CN)typingrrrrrrr hamcrest.core.base_matcherr hamcrest.core.descriptionr "hamcrest.core.helpers.wrap_matcherr hamcrest.core.matcherr __author__ __copyright__ __license__rrrstrr?r;rrrWsMMM21;)  - $  Cx  CL7%k'!Q$-87%v eGAJM&:wwsTUv?W   GAuWQZ]/C,C$DQXYZ\]Y]Q^I_   SWWS#X5F-G C.r