diff --git a/tests/test_vxi11.py b/tests/test_vxi11.py index 84f1dcc..7a338d1 100644 --- a/tests/test_vxi11.py +++ b/tests/test_vxi11.py @@ -1,48 +1,46 @@ #!/usr/bin/env python -import nose -from nose.tools import eq_ from vxi11.vxi11 import parse_visa_resource_string + def test_parse_visa_resource_string(): f = parse_visa_resource_string res = f('TCPIP::10.0.0.1::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP') - eq_(res['arg1'], '10.0.0.1') - eq_(res['suffix'], 'INSTR') + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP' + assert res['arg1'] == '10.0.0.1' + assert res['suffix'] == 'INSTR' res = f('TCPIP0::10.0.0.1::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP0') - eq_(res['arg1'], '10.0.0.1') - eq_(res['suffix'], 'INSTR') + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP0' + assert res['arg1'] == '10.0.0.1' + assert res['suffix'] == 'INSTR' res = f('TCPIP::10.0.0.1::gpib,5::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP') - eq_(res['arg1'], '10.0.0.1') - eq_(res['suffix'], 'INSTR') + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP' + assert res['arg1'] == '10.0.0.1' + assert res['suffix'] == 'INSTR' res = f('TCPIP0::10.0.0.1::gpib,5::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP0') - eq_(res['arg1'], '10.0.0.1') - eq_(res['arg2'], 'gpib,5') - eq_(res['suffix'], 'INSTR') + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP0' + assert res['arg1'] == '10.0.0.1' + assert res['arg2'] == 'gpib,5' + assert res['suffix'] == 'INSTR' res = f('TCPIP0::10.0.0.1::usb0::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP0') - eq_(res['arg1'], '10.0.0.1') - eq_(res['arg2'], 'usb0') - eq_(res['suffix'], 'INSTR') + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP0' + assert res['arg1'] == '10.0.0.1' + assert res['arg2'] == 'usb0' + assert res['suffix'] == 'INSTR' res = f('TCPIP0::10.0.0.1::usb0[1234::5678::MYSERIAL::0]::INSTR') - eq_(res['type'], 'TCPIP') - eq_(res['prefix'], 'TCPIP0') - eq_(res['arg1'], '10.0.0.1') - eq_(res['arg2'], 'usb0[1234::5678::MYSERIAL::0]') - eq_(res['suffix'], 'INSTR') - + assert res['type'] == 'TCPIP' + assert res['prefix'] == 'TCPIP0' + assert res['arg1'] == '10.0.0.1' + assert res['arg2'] == 'usb0[1234::5678::MYSERIAL::0]' + assert res['suffix'] == 'INSTR' diff --git a/vxi11/version.py b/vxi11/version.py index e46aee1..8969d49 100644 --- a/vxi11/version.py +++ b/vxi11/version.py @@ -1 +1 @@ -__version__ = '0.9' +__version__ = '0.9.1' diff --git a/vxi11/vxi11.py b/vxi11/vxi11.py index 231582d..c7f4221 100644 --- a/vxi11/vxi11.py +++ b/vxi11/vxi11.py @@ -131,8 +131,8 @@ def parse_visa_resource_string(resource_string): # TCPIP0::10.0.0.1::gpib,5::INSTR # TCPIP0::10.0.0.1::usb0::INSTR # TCPIP0::10.0.0.1::usb0[1234::5678::MYSERIAL::0]::INSTR - m = re.match('^(?P(?PTCPIP)\d*)(::(?P[^\s:]+))' - '(::(?P[^\s:]+(\[.+\])?))?(::(?PINSTR))$', + m = re.match(r'^(?P(?PTCPIP)\d*)(::(?P[^\s:]+))' + r'(::(?P[^\s:]+(\[.+\])?))?(::(?PINSTR))$', resource_string, re.I) if m is not None: