Skip to content

Commit

Permalink
add tests for Matrix equality (closes #200)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitews committed May 28, 2024
1 parent 833aa19 commit cd50fb2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/matrix_tests.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Matrix class tests
"""
import copy
import unittest
import numpy as np
import pandas as pd
Expand Down Expand Up @@ -81,6 +82,30 @@ def test_parse_csv_file(self):

self.assertIsInstance(comp_mat, fk.Matrix)

def test_matrix_equals(self):
comp_mat = fk.Matrix(
'my_spill',
csv_8c_comp_file_path,
detectors_8c
)

comp_mat2 = copy.deepcopy(comp_mat)

self.assertEqual(comp_mat, comp_mat2)

def test_matrix_equals_fails(self):
comp_mat = fk.Matrix(
'my_spill',
csv_8c_comp_file_path,
detectors_8c
)

# copy & modify matrix array
comp_mat2 = copy.deepcopy(comp_mat)
comp_mat2.matrix[0, 1] = comp_mat2.matrix[0, 1] + 0.01

self.assertNotEqual(comp_mat, comp_mat2)

def test_matrix_as_dataframe(self):
comp_mat = fk.Matrix(
'my_spill',
Expand Down

0 comments on commit cd50fb2

Please sign in to comment.