Ejemplo n.º 1
0
    def test_empty_data(self):
        data = {
            'type': 'generic',
            'data': {},
        }

        assert Mechanism.to_python(data).to_json() == {'type': 'generic'}
Ejemplo n.º 2
0
 def test_data(self):
     data = {
         'type': 'generic',
         'data': {
             'relevant_address': '0x1'
         },
     }
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 3
0
    def test_tag_with_handled(self):
        data = {
            'type': 'generic',
            'handled': False,
        }

        inst = Mechanism.to_python(data)
        assert list(inst.iter_tags()) == [('mechanism', 'generic'),
                                          ('handled', 'no')]
Ejemplo n.º 4
0
 def test_min_errno_meta(self):
     data = {
         'type': 'generic',
         'meta': {
             'errno': {
                 'number': 2,
             }
         }
     }
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 5
0
 def test_min_signal_meta(self):
     data = {
         'type': 'generic',
         'meta': {
             'signal': {
                 'number': 10,
                 'code': 0,
             }
         }
     }
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 6
0
 def test_min_mach_meta(self):
     data = {
         'type': 'generic',
         'meta': {
             'mach_exception': {
                 'exception': 10,
                 'code': 0,
                 'subcode': 0,
             }
         }
     }
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 7
0
 def test_full_signal_meta(self):
     data = {
         'type': 'generic',
         'meta': {
             'signal': {
                 'number': 10,
                 'code': 0,
                 'name': 'SIGBUS',
                 'code_name': 'BUS_NOOP',
             }
         }
     }
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 8
0
 def test_tag(self):
     data = {'type': 'generic'}
     inst = Mechanism.to_python(data)
     assert list(inst.iter_tags()) == [('mechanism', 'generic')]
Ejemplo n.º 9
0
 def test_empty_mechanism(self):
     data = {'type': 'generic'}
     assert Mechanism.to_python(data).to_json() == data
Ejemplo n.º 10
0
 def test_path(self):
     inst = Mechanism.to_python({'type': 'generic'})
     assert inst.get_path() == 'mechanism'