MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / test_dot_product

Method test_dot_product

example_code/item_095.py:122–132  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

120class MyLibraryTest(TestCase):
121
122 def test_dot_product(self):
123 vector3 = ctypes.c_double * size
124 a = vector3(1.0, 2.5, 3.5)
125 b = vector3(-7, 4, -12.1)
126 vector_ptr = ctypes.POINTER(ctypes.c_double)
127 result = my_library.dot_product(
128 3,
129 ctypes.cast(a, vector_ptr),
130 ctypes.cast(b, vector_ptr),
131 )
132 self.assertAlmostEqual(-39.35, result)
133
134import unittest
135

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected