Beispiel #1
0
    def test_fuzzy_candle_equality(self):
        # Arrange
        fuzzy_candle1 = FuzzyCandle(
            CandleDirection.BULL,
            CandleSize.MEDIUM,
            CandleBodySize.MEDIUM,
            CandleWickSize.SMALL,
            CandleWickSize.SMALL,
        )

        fuzzy_candle2 = FuzzyCandle(
            CandleDirection.BULL,
            CandleSize.MEDIUM,
            CandleBodySize.MEDIUM,
            CandleWickSize.SMALL,
            CandleWickSize.SMALL,
        )

        fuzzy_candle3 = FuzzyCandle(
            CandleDirection.BEAR,
            CandleSize.MEDIUM,
            CandleBodySize.MEDIUM,
            CandleWickSize.SMALL,
            CandleWickSize.SMALL,
        )

        # Act
        # Assert
        self.assertTrue(fuzzy_candle1 == fuzzy_candle1)
        self.assertTrue(fuzzy_candle1 == fuzzy_candle2)
        self.assertTrue(fuzzy_candle1 != fuzzy_candle3)
    def test_fuzzy_str_and_repr(self):
        # Arrange
        fuzzy_candle = FuzzyCandle(
            CandleDirection.BULL,
            CandleSize.MEDIUM,
            CandleBodySize.MEDIUM,
            CandleWickSize.SMALL,
            CandleWickSize.SMALL,
        )

        # Act, Assert
        assert str(fuzzy_candle) == "(1, 3, 2, 1, 1)"
        assert repr(fuzzy_candle) == "FuzzyCandle(1, 3, 2, 1, 1)"
Beispiel #3
0
    def test_fuzzy_candle_equality(self):
        # Arrange
        fuzzy_candle1 = FuzzyCandle(CandleDirection.BULL, CandleSize.MEDIUM,
                                    CandleBodySize.MEDIUM,
                                    CandleWickSize.SMALL, CandleWickSize.SMALL)

        fuzzy_candle2 = FuzzyCandle(CandleDirection.BULL, CandleSize.MEDIUM,
                                    CandleBodySize.MEDIUM,
                                    CandleWickSize.SMALL, CandleWickSize.SMALL)

        fuzzy_candle3 = FuzzyCandle(CandleDirection.BEAR, CandleSize.MEDIUM,
                                    CandleBodySize.MEDIUM,
                                    CandleWickSize.SMALL, CandleWickSize.SMALL)

        # Act
        result1 = fuzzy_candle1.__eq__(fuzzy_candle2)
        result2 = fuzzy_candle1 == fuzzy_candle2
        result3 = fuzzy_candle1 == fuzzy_candle3

        # Assert
        self.assertTrue(result1)
        self.assertTrue(result2)
        self.assertFalse(result3)
Beispiel #4
0
    def test_fuzzy_str_and_repr(self):
        # Arrange
        fuzzy_candle = FuzzyCandle(
            CandleDirection.BULL,
            CandleSize.MEDIUM,
            CandleBodySize.MEDIUM,
            CandleWickSize.SMALL,
            CandleWickSize.SMALL,
        )

        # Act
        # Assert
        self.assertEqual("(1, 3, 2, 1, 1)", str(fuzzy_candle))
        self.assertEqual("FuzzyCandle(1, 3, 2, 1, 1)", repr(fuzzy_candle))
Beispiel #5
0
    def test_fuzzy_candle_hashcode(self):
        # Arrange
        fuzzy_candle1 = FuzzyCandle(CandleDirection.BULL, CandleSize.MEDIUM,
                                    CandleBodySize.MEDIUM,
                                    CandleWickSize.SMALL, CandleWickSize.SMALL)

        fuzzy_candle2 = FuzzyCandle(CandleDirection.BULL, CandleSize.MEDIUM,
                                    CandleBodySize.MEDIUM,
                                    CandleWickSize.SMALL, CandleWickSize.SMALL)

        # Act
        hash1 = fuzzy_candle1.__hash__()
        hash2 = fuzzy_candle2.__hash__()

        # Assert
        self.assertEqual(hash1, hash2)