<s> """<STR_LIT>""" <EOL> import unittest <EOL> from bacpypes . debugging import bacpypes_debugging , ModuleLogger , xtob <EOL> from bacpypes . primitivedata import Null , Tag <EOL> _debug = <NUM_LIT:0> <EOL> _log = ModuleLogger ( globals ( ) ) <EOL> @ bacpypes_debugging <EOL> def null_tag ( x ) : <EOL> """<STR_LIT>""" <EOL> if _debug : null_tag . _debug ( "<STR_LIT>" , x ) <EOL> b = xtob ( x ) <EOL> tag = Tag ( Tag . applicationTagClass , Tag . nullAppTag , len ( b ) , b ) <EOL> if _debug : integer_endec . _debug ( "<STR_LIT>" , tag ) <EOL> return tag <EOL> @ bacpypes_debugging <EOL> def null_encode ( obj ) : <EOL> """<STR_LIT>""" <EOL> if _debug : null_encode . _debug ( "<STR_LIT>" , obj ) <EOL> tag = Tag ( ) <EOL> obj . encode ( tag ) <EOL> if _debug : null_encode . _debug ( "<STR_LIT>" , tag ) <EOL> return tag <EOL> @ bacpypes_debugging <EOL> def null_decode ( tag ) : <EOL> """<STR_LIT>""" <EOL> if _debug : null_decode . _debug ( "<STR_LIT>" , tag ) <EOL> obj = Null ( tag ) <EOL> if _debug : null_decode . _debug ( "<STR_LIT>" , obj ) <EOL> return obj <EOL> @ bacpypes_debugging <EOL> def null_endec ( v , x ) : <EOL> """<STR_LIT>""" <EOL> if _debug : null_endec . _debug ( "<STR_LIT>" , v , x ) <EOL> tag = null_tag ( x ) <EOL> if _debug : null_endec . _debug ( "<STR_LIT>" , tag , tag . tagData ) <EOL> obj = Null ( v ) <EOL> if _debug : null_endec . _debug ( "<STR_LIT>" , obj , obj . value ) <EOL> assert null_encode ( obj ) == tag <EOL> assert null_decode ( tag ) == obj <EOL> @ bacpypes_debugging <EOL> class TestNull ( unittest . TestCase ) : <EOL> def test_null ( self ) : <EOL> if _debug : TestInteger . _debug ( "<STR_LIT>" ) <EOL> obj = Null ( ) <EOL> assert obj . value == ( ) <EOL> with self . assertRaises ( TypeError ) : <EOL> Null ( "<STR_LIT>" ) <EOL> with self . assertRaises ( TypeError ) : <EOL> Null ( <NUM_LIT:1.0> ) <EOL> def test_null_null ( self ) : <EOL> if _debug : TestInteger . _debug ( "<STR_LIT>" ) <EOL> obj = Null ( ( ) ) <EOL> assert obj . value == ( ) <EOL> def test_null_tag ( self ) : <EOL> if _debug : TestInteger . _debug ( "<STR_LIT>" ) <EOL> tag = Tag ( Tag . applicationTagClass , Tag . nullAppTag , <NUM_LIT:0> , xtob ( '<STR_LIT>' ) ) <EOL> obj = Null ( tag ) <EOL> assert obj . value == ( ) <EOL> def test_null_copy ( self ) : <EOL> if _debug : TestInteger . _debug ( "<STR_LIT>" ) <EOL> obj1 = Null ( ) <EOL> obj2 = Null ( obj1 ) <EOL> assert obj2 . value == ( ) <EOL> def test_null_endec ( self ) : <EOL> if _debug : TestInteger . _debug ( "<STR_LIT>" ) <EOL> null_endec ( ( ) , '<STR_LIT>' ) </s>
