Skip to content

Commit

Permalink
Test module and github action
Browse files Browse the repository at this point in the history
  • Loading branch information
javinoram committed May 8, 2024
1 parent 7bc93c5 commit 4fab10a
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 2 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/push_event_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Push Event Workflow 🐍

on: push

jobs:
unit-testing:
runs-on: ubuntu-latest

steps:
- name : Checkout code
uses : actions/checkout@v4

- name : Install Packages
run : pip install -r requirements.txt

- name : Run tests hamiltonians
run : pytest tests/test.py

4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ pennylane-qiskit
qiskit_ibm_provider
pyyaml
networkx
basis-set-exchange
ipykernel
pennylane-lightning
jaxopt
optax
optax
pytest
Empty file added tests/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pennylane as qml
from pennylane import numpy as np
from quantumsim.variational.vqe import vqe_spin, vqe_fermihubbard, vqe_molecular

#Test the hamiltonian of the h2 molecule
def test_hamiltonian_molecule():
#pennylane hamiltonian
elements=["H", "H"]
coord=np.array([0.0, 0.0, 0.0, 0.0, 0.0, 1.0])
H,q = qml.qchem.molecular_hamiltonian(elements, coord)

#vqepy class
Hvqe = vqe_molecular(elements, coord, {})
assert H.compare(Hvqe.hamiltonian)


0 comments on commit 4fab10a

Please sign in to comment.