(self)
| 1633 | assert_equal(test, [33, 66]) |
| 1634 | |
| 1635 | def test_invalid_converter(self): |
| 1636 | strip_rand = lambda x: float((b'r' in x.lower() and x.split()[-1]) or |
| 1637 | ((b'r' not in x.lower() and x.strip()) or 0.0)) |
| 1638 | strip_per = lambda x: float((b'%' in x.lower() and x.split()[0]) or |
| 1639 | ((b'%' not in x.lower() and x.strip()) or 0.0)) |
| 1640 | s = TextIO("D01N01,10/1/2003 ,1 %,R 75,400,600\r\n" |
| 1641 | "L24U05,12/5/2003, 2 %,1,300, 150.5\r\n" |
| 1642 | "D02N03,10/10/2004,R 1,,7,145.55") |
| 1643 | kwargs = { |
| 1644 | "converters": {2: strip_per, 3: strip_rand}, "delimiter": ",", |
| 1645 | "dtype": None, "encoding": "bytes"} |
| 1646 | assert_raises(ConverterError, np.genfromtxt, s, **kwargs) |
| 1647 | |
| 1648 | def test_tricky_converter_bug1666(self): |
| 1649 | # Test some corner cases |
nothing calls this directly
no test coverage detected