Пример #1
0
    def check_bin_file(self, bits, ans):
        name = 'a.out'
        p = os.path.join(self.dir, name)

        with open(p, 'wb') as f:
            f.write(bits)

        content = LocalDoc._encode_content(name, p)
        assert content == 'base64-encoded;' + ans
Пример #2
0
    def check_text_file(self, ans):
        name = 'README.rst'
        p = os.path.join(self.dir, name)

        with open(p, 'wb') as f:
            f.write(ans)

        content = LocalDoc._encode_content(name, p)
        assert content == ans.decode('utf8'), content
Пример #3
0
    def check_json_suffix(self, content, ans):
        name = 'magic.json'
        p = os.path.join(self.dir, name)

        with open(p, 'w') as f:
            f.write(content)

        content = LocalDoc._encode_content(name, p)
        assert content == ans
Пример #4
0
    def check_bin_file(self, bits, ans):
        name = 'a.out'
        p = os.path.join(self.dir, name)

        with open(p, 'wb') as f:
            f.write(bits)

        content = LocalDoc._encode_content(name, p)
        assert content == 'base64-encoded;' + ans
Пример #5
0
    def check_text_file(self, ans):
        name = 'README.rst'
        p = os.path.join(self.dir, name)

        with open(p, 'wb') as f:
            f.write(ans)

        content = LocalDoc._encode_content(name, p)
        assert content == ans.decode('utf8'), content
Пример #6
0
    def check_json_suffix(self, content, ans):
        name = 'magic.json'
        p = os.path.join(self.dir, name)

        with open(p, 'w') as f:
            f.write(content)

        content = LocalDoc._encode_content(name, p)
        assert content == ans