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

Add actions for unittests #41

Merged
merged 8 commits into from
Nov 6, 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
27 changes: 27 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Unittests

on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade pip setuptools wheel
python -m pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
python -m pip install -e .
- name: Display Python version
run: python -m unittest discover -s tests/unit
3 changes: 1 addition & 2 deletions chebai/preprocessing/structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import networkx as nx
import torch
from torch.utils.data.dataset import T_co


class XYData(torch.utils.data.Dataset):
Expand All @@ -23,7 +22,7 @@ def __init__(
self.x = x
self.y = y

def __getitem__(self, index: int) -> T_co:
def __getitem__(self, index: int):
"""Returns the data and target at the given index."""
return self.x[index], self.y[index]

Expand Down
Loading