<s> import unittest <EOL> import dns . update <EOL> import dns . rdata <EOL> import dns . rdataset <EOL> goodhex = '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' '<STR_LIT>' <EOL> goodwire = goodhex . replace ( '<STR_LIT:U+0020>' , '<STR_LIT>' ) . decode ( '<STR_LIT>' ) <EOL> update_text = """<STR_LIT>""" <EOL> class UpdateTestCase ( unittest . TestCase ) : <EOL> def test_to_wire1 ( self ) : <EOL> update = dns . update . Update ( '<STR_LIT>' ) <EOL> update . id = <NUM_LIT:1> <EOL> update . present ( '<STR_LIT:foo>' ) <EOL> update . present ( '<STR_LIT:foo>' , '<STR_LIT:a>' ) <EOL> update . present ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . replace ( '<STR_LIT:foo>' , <NUM_LIT> , '<STR_LIT:a>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> update . add ( '<STR_LIT:bar>' , <NUM_LIT> , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . delete ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . delete ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . delete ( '<STR_LIT>' ) <EOL> self . failUnless ( update . to_wire ( ) == goodwire ) <EOL> def test_to_wire2 ( self ) : <EOL> update = dns . update . Update ( '<STR_LIT>' ) <EOL> update . id = <NUM_LIT:1> <EOL> update . present ( '<STR_LIT:foo>' ) <EOL> update . present ( '<STR_LIT:foo>' , '<STR_LIT:a>' ) <EOL> update . present ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . replace ( '<STR_LIT:foo>' , <NUM_LIT> , '<STR_LIT:a>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> update . add ( '<STR_LIT:bar>' , <NUM_LIT> , dns . rdata . from_text ( <NUM_LIT:1> , <NUM_LIT:1> , '<STR_LIT>' ) ) <EOL> update . delete ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . delete ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . delete ( '<STR_LIT>' ) <EOL> self . failUnless ( update . to_wire ( ) == goodwire ) <EOL> def test_to_wire3 ( self ) : <EOL> update = dns . update . Update ( '<STR_LIT>' ) <EOL> update . id = <NUM_LIT:1> <EOL> update . present ( '<STR_LIT:foo>' ) <EOL> update . present ( '<STR_LIT:foo>' , '<STR_LIT:a>' ) <EOL> update . present ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' ) <EOL> update . absent ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . replace ( '<STR_LIT:foo>' , <NUM_LIT> , '<STR_LIT:a>' , '<STR_LIT>' , '<STR_LIT>' ) <EOL> update . add ( '<STR_LIT:bar>' , dns . rdataset . from_text ( <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT> , '<STR_LIT>' ) ) <EOL> update . delete ( '<STR_LIT:bar>' , '<STR_LIT:a>' , '<STR_LIT>' ) <EOL> update . delete ( '<STR_LIT>' , '<STR_LIT:a>' ) <EOL> update . delete ( '<STR_LIT>' ) <EOL> self . failUnless ( update . to_wire ( ) == goodwire ) <EOL> def test_from_text1 ( self ) : <EOL> update = dns . message . from_text ( update_text ) <EOL> w = update . to_wire ( origin = dns . name . from_text ( '<STR_LIT>' ) , <EOL> want_shuffle = False ) <EOL> self . failUnless ( w == goodwire ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
