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))
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')")
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__)