netwatch.py/netaddr-0.7.10/netaddr/tests/2.x/eui/pubsub.txt

53 lines
1.2 KiB
Plaintext

=IEEE Publish/Subscribe Parser Tests=
Copyright (c) 2008-2012, David P. D. Moss. All rights reserved.
Basic OUIIndexParser and FileIndexer object tests.
{{{
>>> from netaddr.eui.ieee import OUIIndexParser, IABIndexParser, FileIndexer
>>> from cStringIO import StringIO
>>> infile = StringIO()
>>> outfile = StringIO()
>>> infile.write("""
... 00-CA-FE (hex) ACME CORPORATION
... 00CAFE (base 16) ACME CORPORATION
... 1 MAIN STREET
... SPRINGFIELD
... UNITED STATES
... """)
>>> infile.seek(0)
>>> iab_parser = OUIIndexParser(infile)
>>> iab_parser.attach(FileIndexer(outfile))
>>> iab_parser.parse()
>>> print outfile.getvalue(),
51966,1,210
}}}
Basic IABIndexParser and FileIndexer object tests.
{{{
>>> infile = StringIO()
>>> outfile = StringIO()
>>> infile.write("""
... 00-50-C2 (hex) ACME CORPORATION
... ABC000-ABCFFF (base 16) ACME CORPORATION
... 1 MAIN STREET
... SPRINGFIELD
... UNITED STATES
... """)
>>> infile.seek(0)
>>> iab_parser = IABIndexParser(infile)
>>> iab_parser.attach(FileIndexer(outfile))
>>> iab_parser.parse()
>>> print outfile.getvalue(),
84683452,1,181
}}}