Changeset 7276 for misc/tools/pytools/test_pytools.py
- Timestamp:
- Jun 30, 2009, 2:07:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
misc/tools/pytools/test_pytools.py
r18 r7276 1 1 import unittest 2 import Numeric2 import numpy as num 3 3 from combinatorics import bitvector 4 4 from numtools import expand … … 14 14 15 15 d = 4 16 assert Numeric.allclose(bitvector(0, d), Numeric.array([0,0,0,0]))17 assert Numeric.allclose(bitvector(1, d), Numeric.array([1,0,0,0]))18 assert Numeric.allclose(bitvector(2, d), Numeric.array([0,1,0,0]))19 assert Numeric.allclose(bitvector(3, d), Numeric.array([1,1,0,0]))20 assert Numeric.allclose(bitvector(4, d), Numeric.array([0,0,1,0]))21 assert Numeric.allclose(bitvector(5, d), Numeric.array([1,0,1,0]))22 assert Numeric.allclose(bitvector(6, d), Numeric.array([0,1,1,0]))23 assert Numeric.allclose(bitvector(7, d), Numeric.array([1,1,1,0]))24 assert Numeric.allclose(bitvector(8, d), Numeric.array([0,0,0,1]))25 assert Numeric.allclose(bitvector(9, d), Numeric.array([1,0,0,1]))26 assert Numeric.allclose(bitvector(10, d), Numeric.array([0,1,0,1]))27 assert Numeric.allclose(bitvector(11, d), Numeric.array([1,1,0,1]))28 assert Numeric.allclose(bitvector(12, d), Numeric.array([0,0,1,1]))29 assert Numeric.allclose(bitvector(13, d), Numeric.array([1,0,1,1]))30 assert Numeric.allclose(bitvector(14, d), Numeric.array([0,1,1,1]))31 assert Numeric.allclose(bitvector(15, d), Numeric.array([1,1,1,1]))16 assert num.allclose(bitvector(0, d), num.array([0,0,0,0])) 17 assert num.allclose(bitvector(1, d), num.array([1,0,0,0])) 18 assert num.allclose(bitvector(2, d), num.array([0,1,0,0])) 19 assert num.allclose(bitvector(3, d), num.array([1,1,0,0])) 20 assert num.allclose(bitvector(4, d), num.array([0,0,1,0])) 21 assert num.allclose(bitvector(5, d), num.array([1,0,1,0])) 22 assert num.allclose(bitvector(6, d), num.array([0,1,1,0])) 23 assert num.allclose(bitvector(7, d), num.array([1,1,1,0])) 24 assert num.allclose(bitvector(8, d), num.array([0,0,0,1])) 25 assert num.allclose(bitvector(9, d), num.array([1,0,0,1])) 26 assert num.allclose(bitvector(10, d), num.array([0,1,0,1])) 27 assert num.allclose(bitvector(11, d), num.array([1,1,0,1])) 28 assert num.allclose(bitvector(12, d), num.array([0,0,1,1])) 29 assert num.allclose(bitvector(13, d), num.array([1,0,1,1])) 30 assert num.allclose(bitvector(14, d), num.array([0,1,1,1])) 31 assert num.allclose(bitvector(15, d), num.array([1,1,1,1])) 32 32 33 33 … … 35 35 36 36 d = 4 37 mask = Numeric.array([0,1,1,0,1])38 v = Numeric.array([2,3,4])37 mask = num.array([0,1,1,0,1]) 38 v = num.array([2,3,4]) 39 39 40 assert Numeric.allclose(expand(v, mask), Numeric.array([0,2,3,0,4]))40 assert num.allclose(expand(v, mask), num.array([0,2,3,0,4])) 41 41 42 42
Note: See TracChangeset
for help on using the changeset viewer.