()
| 104 | |
| 105 | |
| 106 | def test_assembly(): |
| 107 | ass = inferenceutils.Assembly(3) |
| 108 | assert len(ass) == 0 |
| 109 | |
| 110 | j1 = inferenceutils.Joint((1, 1), label=0) |
| 111 | j2 = inferenceutils.Joint((1, 1), label=1) |
| 112 | assert ass.add_link(inferenceutils.Link(j1, j2), store_dict=True) |
| 113 | assert len(ass) == 2 |
| 114 | assert ass.data[j2.label, 0] == 1 |
| 115 | assert ass.data[j2.label, -1] == -1 |
| 116 | assert ass.area == 0 |
| 117 | assert ass.intersection_with(ass) == 1.0 |
| 118 | # Original (cached) coordinates must have remained empty |
| 119 | assert np.all(np.isnan(ass._dict["data"][:, :2])) |
| 120 | |
| 121 | ass.remove_joint(j2) |
| 122 | assert len(ass) == 1 |
| 123 | assert np.all(np.isnan(ass.data[j2.label])) |
| 124 | |
| 125 | ass2 = inferenceutils.Assembly(2) |
| 126 | ass2.add_link(inferenceutils.Link(j1, j2)) |
| 127 | with pytest.raises(ValueError): |
| 128 | _ = ass + ass2 |
| 129 | ass2.remove_joint(j1) |
| 130 | assert ass2 not in ass |
| 131 | ass3 = ass + ass2 |
| 132 | assert len(ass3) == 2 |
| 133 | |
| 134 | |
| 135 | def test_assembler(tmpdir_factory, real_assemblies): |
nothing calls this directly
no test coverage detected