MCPcopy Create free account
hub / github.com/boostorg/build / expect_content

Method expect_content

v2/test/BoostBuild.py:723–751  ·  view source on GitHub ↗
(self, name, content, exact=False)

Source from the content-addressed store, hash-verified

721 self.__expect_lines(self.__read_file(filename), line, expected)
722
723 def expect_content(self, name, content, exact=False):
724 actual = self.__read_file(name, exact)
725 content = content.replace("$toolset", self.toolset + "*")
726
727 matched = False
728 if exact:
729 matched = fnmatch.fnmatch(actual, content)
730 else:
731 def sorted_(x):
732 x.sort()
733 return x
734 actual_ = map(lambda x: sorted_(x.split()), actual.splitlines())
735 content_ = map(lambda x: sorted_(x.split()), content.splitlines())
736 if len(actual_) == len(content_):
737 matched = map(
738 lambda x, y: map(lambda n, p: fnmatch.fnmatch(n, p), x, y),
739 actual_, content_)
740 matched = reduce(
741 lambda x, y: x and reduce(
742 lambda a, b: a and b,
743 y),
744 matched)
745
746 if not matched:
747 print "Expected:\n"
748 print content
749 print "Got:\n"
750 print actual
751 self.fail_test(1)
752
753 def maybe_do_diff(self, actual, expected):
754 if os.environ.get("DO_DIFF"):

Callers 12

test_basicFunction · 0.95
test_merge_twoFunction · 0.95
test_merge_existingFunction · 0.95
test_merge_recursiveFunction · 0.95
project_test3.pyFile · 0.80
project_test4.pyFile · 0.80
print.pyFile · 0.80
source_order.pyFile · 0.80
core_at_file.pyFile · 0.80
regression.pyFile · 0.80

Calls 2

__read_fileMethod · 0.95
fail_testMethod · 0.95

Tested by 5

test_basicFunction · 0.76
test_merge_twoFunction · 0.76
test_merge_existingFunction · 0.76
test_merge_recursiveFunction · 0.76