Changes between Version 94 and Version 95 of j2p
- Timestamp:
- 07/01/24 10:06:06 (4 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
j2p
v94 v95 186 186 }}} 187 187 188 == Unit Tests, @Test189 In python, a class with tests must extend {{{unittest.TestCase}}}. This allows discovery by the py test tools. In Python the mechanism is slightly different, requiring the test class to extend TestCase. To support the translation mechanism and make our lives a bit easier, j2p requires all tests to be annotates with @RunWith. Use the following, depending on what kind of test you want to run:190 191 ||= test type in java =||= use java annotation =||192 ||normal @Test methods||@RunWith(JUnit4ClassRunner.class)||193 ||parametric test||@RunWith(Parameterized.class)||194 195 196 197 188 198 189 === More notes: … … 295 286 then l is of type List (the Interface) and l.get is a function in the interface which needs to be translated. Note that in general any type of List can end up in l at runtime, the compiler has to compile it such that the compiled code will work regardless (thus using only functions available in python's equivalent of the List class). 296 287 288 289 290 === Unit Tests, @Test 291 The junit-t plugin helps translation of org.junit components. 292 In python, a class with tests must extend {{{unittest.TestCase}}}. This allows discovery by the py test tools. In Python the mechanism is slightly different, requiring the test class to extend TestCase. To support the translation mechanism and make our lives a bit easier, j2p requires all tests to be annotates with @RunWith. Use the following, depending on what kind of test you want to run: 293 294 ||= test type in java =||= use java annotation =|| 295 ||normal @Test methods||@RunWith(JUnit4ClassRunner.class)|| 296 ||parametric test||@RunWith(Parameterized.class)|| 297 298 299 300 301 297 302 == Resulting file 298 303