コード例 #1
0
    def test_custom(self):
        # sane
        sane = Grouping.custom("class.path")
        self.assertEqual(sane.gtype, topology_pb2.Grouping.Value("CUSTOM"))
        self.assertTrue(isinstance(sane.python_serialized, bytes))

        # arg not string
        with self.assertRaises(TypeError):
            Grouping.custom(None)
        with self.assertRaises(TypeError):
            Grouping.custom(True)
コード例 #2
0
ファイル: stream_unittest.py プロジェクト: billonahill/heron
  def test_custom(self):
    # sane
    sane = Grouping.custom("class.path")
    self.assertEqual(sane.gtype, topology_pb2.Grouping.Value("CUSTOM"))
    self.assertTrue(isinstance(sane.python_serialized, bytes))

    # arg not string
    with self.assertRaises(TypeError):
      Grouping.custom(None)
    with self.assertRaises(TypeError):
      Grouping.custom(True)
コード例 #3
0
    def test_is_grouping_sane(self):
        self.assertTrue(Grouping.is_grouping_sane(Grouping.ALL))
        self.assertTrue(Grouping.is_grouping_sane(Grouping.SHUFFLE))
        self.assertTrue(Grouping.is_grouping_sane(Grouping.LOWEST))
        self.assertTrue(Grouping.is_grouping_sane(Grouping.NONE))

        self.assertFalse(Grouping.is_grouping_sane(Grouping.FIELDS))
        sane_fields = Grouping.fields(['hello', 'world'])
        self.assertTrue(Grouping.is_grouping_sane(sane_fields))

        self.assertFalse(Grouping.is_grouping_sane(Grouping.CUSTOM))
        sane_custom = Grouping.custom("class.path")
        self.assertTrue(Grouping.is_grouping_sane(sane_custom))
コード例 #4
0
ファイル: stream_unittest.py プロジェクト: billonahill/heron
  def test_is_grouping_sane(self):
    self.assertTrue(Grouping.is_grouping_sane(Grouping.ALL))
    self.assertTrue(Grouping.is_grouping_sane(Grouping.SHUFFLE))
    self.assertTrue(Grouping.is_grouping_sane(Grouping.LOWEST))
    self.assertTrue(Grouping.is_grouping_sane(Grouping.NONE))

    self.assertFalse(Grouping.is_grouping_sane(Grouping.FIELDS))
    sane_fields = Grouping.fields(['hello', 'world'])
    self.assertTrue(Grouping.is_grouping_sane(sane_fields))

    self.assertFalse(Grouping.is_grouping_sane(Grouping.CUSTOM))
    sane_custom = Grouping.custom("class.path")
    self.assertTrue(Grouping.is_grouping_sane(sane_custom))