code: def test_attribute_mixing_matrix_directed(self):
      mapping = {"one": 0, "two": 1, "red": 2, "blue": 3}
      a_result = np.array(
          [[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 0, 0], [0, 0, 0, 0]]
      )
      a = nx.attribute_mixing_matrix(
          self.D, "fish", mapping=mapping, normalized=False
      )
      np.testing.assert_equal(a, a_result)
      a = nx.attribute_mixing_matrix(self.D, "fish", mapping=mapping)
      np.testing.assert_equal(a, a_result / a_result.sum())
  
imports: import pytest
  import networkx
  from .base_test import BaseTestAttributeMixing, BaseTestDegreeMixing
label_desc: Use image node_id 2 for calling the TestAttributeMixingMatrix obj's underlying member method code with example usage: obj.test_attribute_mixing_matrix_directed() without return types