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

Method expect_content

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

Source from the content-addressed store, hash-verified

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