Exemplo n.º 1
0
 def test__does_not_match_when_comparing_text_to_binary(self):
     contents = factory.make_string()  # text
     filename = self.make_file(contents=contents.encode("ascii"))
     matcher = FileContains(contents=contents)
     self.assertMismatch(
         matcher.match(filename), "%r != %r" % (
             contents.encode("ascii"), contents))
Exemplo n.º 2
0
 def test__does_not_match_when_comparing_binary_to_text(self):
     contents = factory.make_string().encode("ascii")  # bytes
     filename = self.make_file(contents=contents)
     matcher = FileContains(contents=contents, encoding="ascii")
     self.assertMismatch(
         matcher.match(filename), "%r != %r" % (
             contents.decode("ascii"), contents))