Exemplo n.º 1
0
    def _static_representation(self, bento_info):
        r_pkg = PackageDescription.from_string(bento_info)
        # We recompute pkg to avoid dealing with stylistic difference between
        # original and static_representation
        pkg = PackageDescription.from_string(static_representation(r_pkg))

        self.assertEqual(static_representation(pkg), static_representation(r_pkg))
Exemplo n.º 2
0
    def test_simple(self):
        text = """\
NName: foo
"""
        self.assertRaises(ParseError, lambda : PackageDescription.from_string(text))

        try:
            PackageDescription.from_string(text)
            raise AssertionError("Should raise here !")
        except ParseError, e:
            self.assertEqual(str(e), "yacc: Syntax error at line 1, Token(WORD, 'NName')")
Exemplo n.º 3
0
    def test_error_string(self):
        f = self.f
        f.write("NName: foo")
        f.flush()
        try:
            PackageDescription.from_file(f.name)
            raise AssertionError("Should raise here !")
        except ParseError, e:
            self.assertEqual(str(e), """\
  File "%s", line 1
NName: foo
^
Syntax error""" % f.name)
Exemplo n.º 4
0
    def test_simple(self):
        text = """\
Name: foo

DataFiles: data
    TargetDir: $datadir
    Files:
        foo.data
"""
        r_data = DataFiles("data", files=["foo.data"], target_dir="$datadir")
        pkg = PackageDescription.from_string(text)
        self.failUnless("data" in pkg.data_files)
        assert_equal(pkg.data_files["data"].__dict__, r_data.__dict__)
Exemplo n.º 5
0
 def test_simple_filename(self):
     f = self.f
     f.write("NName: foo")
     f.flush()
     self.assertRaises(ParseError, lambda : PackageDescription.from_file(f.name))