Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build ingestion #1

Merged
merged 3 commits into from
Feb 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions reference_network/publication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Publication:
def __init__(self, title, authors, year, doi, references):
self.title = title
self.authors = authors
self.year = year
self.doi = doi
self.references = references

def add_reference(self, reference):
self.references.append(reference)
Empty file added tests/test_graph_visualizer.py
Empty file.
43 changes: 43 additions & 0 deletions tests/test_publication.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This class represents a single publication. It should store relevant metadata such as title, authors, publication year, DOI, and references (citations).

# Attributes:
# Title
# Authors
# Year
# DOI
# References (list of DOIs or titles of cited publications)

# Methods:
# Constructor to initialize the publication with its metadata
# Method to add a reference
# (Optional) Method to fetch metadata from external sources like DOI

import pytest
from reference_network.publication import Publication


@pytest.fixture
def sample_publication():
title = "Sample Publication"
authors = ["Author One", "Author Two"]
year = 2024
doi = "10.1000/sampledoi"
references = ["10.1000/ref1", "10.1000/ref2"]
return Publication(title, authors, year, doi, references)


def test_publication_initialization(sample_publication):
pub = sample_publication
assert pub.title == "Sample Publication"
assert pub.authors == ["Author One", "Author Two"]
assert pub.year == 2024
assert pub.doi == "10.1000/sampledoi"
assert pub.references == ["10.1000/ref1", "10.1000/ref2"]


def test_publication_add_reference(sample_publication):
pub = sample_publication
new_reference = "10.1000/newref"
pub.add_reference(new_reference)
assert new_reference in pub.references
assert len(pub.references) == 3 # Assuming initial references are counted
Empty file.
Empty file added tests/test_reference_graph.py
Empty file.
Loading