Compare commits

..

5 Commits

Author SHA1 Message Date
5b69fe25b4 Link from Day 5 2025-10-24 20:34:06 +00:00
97d4d9c9a7 Fix #12
accidentally opening a jupyter notebook in api/
caused apidoc to try to incorporate that into
the api docs.
2025-10-24 15:10:13 -05:00
e3ffd2210b Merge pull request 'Implement Unit Testing for fancymath' (#8) from unit_tests into main
Reviewed-on: #8
2025-10-24 17:10:58 +00:00
aa7dc496dc Merge pull request 'Add subtests for test_cross_product.' (#11) from test/vector-cross-subtests into unit_tests
Reviewed-on: #11
Reviewed-by: Tim Diller <tim@dillerdigital.com>
2025-10-24 16:09:11 +00:00
Corran Webster
66123f6064 Add subtests for test_cross_product. 2025-10-24 16:54:47 +01:00
4 changed files with 26 additions and 12 deletions

1
.gitignore vendored
View File

@@ -4,3 +4,4 @@
*.egg-info *.egg-info
doc/_build/ doc/_build/
*.ipynb_checkpoints/ *.ipynb_checkpoints/
fancymath.log

View File

@@ -50,3 +50,6 @@ $ pip install -e .
python -m line_profiler -rmt module_to_profile.py.lprof python -m line_profiler -rmt module_to_profile.py.lprof
> python -m line_profiler -rmt module_to_profile.py.lprof > python -m line_profiler -rmt module_to_profile.py.lprof
``` ```
# Day 5 Resources
- [5 Worlds](https://www.joelonsoftware.com/2002/05/06/five-worlds/) from Joel Spolsky's blog.

View File

@@ -17,7 +17,13 @@ release = '0.0.1'
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"] extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode"]
templates_path = ['_templates'] templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.ipynb_checkpoints'] exclude_patterns = [
'_build',
'Thumbs.db',
'.DS_Store',
'.ipynb_checkpoints',
'api/.ipynb_checkpoints'
]

View File

@@ -5,18 +5,22 @@ from fancymath.vector import Vector
class TestVector(unittest.TestCase): class TestVector(unittest.TestCase):
def test_cross_product(self): def test_cross_product(self):
# given # Dictionary of (v1, v2): v3
v1 = Vector(1, 2, 3) values = {
v2 = Vector(3, 2, 1) (Vector(1, 2, 3), Vector(3, 2, 1)): Vector(-4, 8, -4),
(Vector(0, 0, 0), Vector(1, 2, 3)): Vector(0, 0, 0),
(Vector(1, 0, 0), Vector(1, 0, 0)): Vector(0, 0, 0),
}
# when for inputs, expected in values.items():
v3 = v1 * v2 v1, v2 = inputs
with self.subTest(v1=v1, v2=v2):
v3 = v1 * v2
# then self.assertIsInstance(v3, Vector)
self.assertIsInstance(v3, Vector) self.assertEqual(v3.x, expected.x)
self.assertEqual(v3.x, -4) self.assertEqual(v3.y, expected.y)
self.assertEqual(v3.y, 8) self.assertEqual(v3.z, expected.z)
self.assertEqual(v3.z, -4)
def test_cross_product_failure(self): def test_cross_product_failure(self):
v1 = Vector(1, 2, 3) v1 = Vector(1, 2, 3)