コード例 #1
0
    def testModalityRegistration(self):
        @registry.register_symbol_modality
        class MySymbolModality(modality.Modality):
            pass

        @registry.register_audio_modality
        class MyAudioModality(modality.Modality):
            pass

        @registry.register_image_modality
        class MyImageModality(modality.Modality):
            pass

        @registry.register_class_label_modality
        class MyClassLabelModality(modality.Modality):
            pass

        self.assertTrue(
            registry.symbol_modality("my_symbol_modality") is MySymbolModality)
        self.assertTrue(
            registry.audio_modality("my_audio_modality") is MyAudioModality)
        self.assertTrue(
            registry.image_modality("my_image_modality") is MyImageModality)
        self.assertTrue(
            registry.class_label_modality("my_class_label_modality") is
            MyClassLabelModality)
コード例 #2
0
  def testModalityRegistration(self):

    @registry.register_symbol_modality
    class MySymbolModality(modality.Modality):
      pass

    @registry.register_audio_modality
    class MyAudioModality(modality.Modality):
      pass

    @registry.register_image_modality
    class MyImageModality(modality.Modality):
      pass

    @registry.register_class_label_modality
    class MyClassLabelModality(modality.Modality):
      pass

    self.assertTrue(
        registry.symbol_modality("my_symbol_modality") is MySymbolModality)
    self.assertTrue(
        registry.audio_modality("my_audio_modality") is MyAudioModality)
    self.assertTrue(
        registry.image_modality("my_image_modality") is MyImageModality)
    self.assertTrue(
        registry.class_label_modality("my_class_label_modality") is
        MyClassLabelModality)