-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compute_for): support ranges and generic iterables
- Loading branch information
Showing
4 changed files
with
76 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
import unittest | ||
import pythonmonkey as pm | ||
import dcp | ||
dcp.init() | ||
|
||
class TestComputeFor(unittest.TestCase): | ||
|
||
def test_compute_for(self): | ||
dcp.init() | ||
job1 = dcp.compute_for('x=>{progress(); return x * 2}', [1,2,3]) | ||
job1 = dcp.compute_for([1,2,3], 'x=>{progress(); return x * 2}') | ||
job2 = dcp.compute.do(5, 'x=>{progress(); return x * 2}') | ||
|
||
# check compute_for returns the same type as compute.do | ||
self.assertTrue(isinstance(job1, job2.__class__)) | ||
|
||
def test_smoke_bf2_attrs(self): | ||
job = dcp.compute_for('x=>{progress(); return x * 2}', [1,2,3]) | ||
job = dcp.compute_for([1,2,3], 'x=>{progress(); return x * 2}') | ||
self.assertTrue(hasattr(job, 'wait')) | ||
|
||
def test_range_and_iterables(self): | ||
dcp.compute_for(range(1,4), '') | ||
pass | ||
|
||
if __name__ == '__main__': | ||
unittest.main() | ||
|