How to use the check50.File function in check50

To help you get started, we’ve selected a few check50 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cs50 / check50 / checks / cs50 / 2017 / x / mario / more / checks.py View on Github external
def test0(self):
        """handles a height of 0 correctly"""
        self.spawn("./mario").stdin("0").stdout(File("0.txt")).exit(0)
github cs50 / check50 / checks / cs50 / 2017 / x / mario / more / checks.py View on Github external
def test24(self):
        """rejects a height of 24, and then accepts a height of 2"""
        self.spawn("./mario").stdin("24").reject()\
            .stdin("2").stdout(File("2.txt")).exit(0)
github cs50 / check50 / check50.py View on Github external
def append_code(self, original, codefile):
        if isinstance(original, File):
            original = original.filename

        if isinstance(codefile, File):
            codefile = codefile.filename

        with open(codefile) as code, open(original, "a") as o:
            o.write("\n")
            o.write(code.read())
github cs50 / check50 / checks / cs50 / 2017 / x / mario / more / checks.py View on Github external
def test2(self):
        """handles a height of 2 correctly"""
        out = self.spawn("./mario").stdin("2").stdout()
        correct = File("2.txt").read()
        check_pyramid(out, correct)
github cs50 / check50 / check50.py View on Github external
def read(self):
        with File._open(self.filename) as f:
            return f.read()
github cs50 / check50 / checks / cs50 / 2017 / x / mario / more / checks.py View on Github external
def test23(self):
        """handles a height of 23 correctly"""
        out = self.spawn("./mario").stdin("23").stdout()
        correct = File("23.txt").read()
        check_pyramid(out, correct)
github cs50 / check50 / checks / cs50 / 2017 / x / mario / more / checks.py View on Github external
def test1(self):
        """handles a height of 1 correctly"""
        out = self.spawn("./mario").stdin("1").stdout()
        correct = File("1.txt").read()
        check_pyramid(out, correct)