Exemplo n.º 1
0
class POSPackageTests(unittest.TestCase):
    def setUp(self):
        self.pos = PosPackage()
        self.pos.document = parse(join(dirname(folder), pos_test_record))

    def test_authors(self):
        self.assertEqual(self.pos._get_authors(), ['El-Khadra, Aida', 'Johnson, A.T.'])

    def test_language(self):
        self.assertEqual(self.pos._get_language(), 'en')

    def test_publisher(self):
        self.assertEqual(self.pos._get_publisher(), 'SISSA')

    def test_date(self):
        self.assertEqual(self.pos._get_date(), '2014-03-19')

    def test_copyright(self):
        self.assertEqual(self.pos._get_copyright(), 'CC-BY-NC-SA')

    def test_subject(self):
        self.assertEqual(self.pos._get_subject(), 'Lattice Field Theory')

    def test_identifier(self):
        self.assertEqual(self.pos.get_identifier(), 'oai:pos.sissa.it:LATTICE 2013/001')
Exemplo n.º 2
0
class POSPackageTests(unittest.TestCase):

    """Tests for the PosPackage."""

    def setUp(self):
        """Setup test."""
        self.pos = PosPackage()
        sample_filepath = pkg_resources.resource_filename(
            'harvestingkit.tests',
            os.path.join('data', 'sample_pos_record.xml')
        )
        self.pos.document = parse(sample_filepath)

    def test_authors(self):
        """Test the field authors."""
        self.assertEqual(self.pos._get_authors(),
                         [('El-Khadra, Aida', ['INFN and Università di Firenze'])])

    def test_language(self):
        """Test the field language."""
        self.assertEqual(self.pos._get_language(), 'en')

    def test_publisher(self):
        """Test the field publisher."""
        self.assertEqual(self.pos._get_publisher(), 'SISSA')

    def test_date(self):
        """Test the field date."""
        self.assertEqual(self.pos._get_date(), '2014-03-19')

    def test_title(self):
        """Test the field title."""
        self.assertEqual(self.pos._get_title(), 'Heavy Flavour Physics Review')

    def test_copyright(self):
        """Test the field copyright."""
        self.assertEqual(self.pos._get_copyright(), 'CC-BY-NC-SA')

    def test_subject(self):
        """Test the field subject."""
        self.assertEqual(self.pos._get_subject(), 'Lattice Field Theory')

    def test_identifier(self):
        """Test the field identifier."""
        self.assertEqual(self.pos.get_identifier(), 'oai:pos.sissa.it:LATTICE 2013/001')

    def test_record(self):
        """Test the field identifier."""
        record = self.pos.get_record(self.pos.document)
        self.assertTrue(record["100"])
        self.assertTrue(record["980"])