Beispiel #1
0
    def test_strategy_identifier(self):
        # Arrange
        # Act
        strategy_id1 = StrategyId.null()
        strategy_id2 = StrategyId("SCALPER", "01")

        # Assert
        assert "NULL-NULL" == strategy_id1.value
        assert strategy_id1 == strategy_id1
        assert strategy_id1 != strategy_id2
        assert "NULL" == strategy_id1.name
        assert strategy_id2 == StrategyId.from_str("SCALPER-01")
    def test_strategy_identifier(self):
        # Arrange
        # Act
        strategy_id1 = StrategyId.null()
        strategy_id2 = StrategyId("SCALPER", "01")

        # Assert
        self.assertEqual("S-NULL", strategy_id1.value)
        self.assertEqual(strategy_id1, strategy_id1)
        self.assertNotEqual(strategy_id1, strategy_id2)
        self.assertEqual("S", strategy_id1.name)
        self.assertEqual(strategy_id2, StrategyId.from_str('SCALPER-01'))
Beispiel #3
0
 def test_strategy_id_given_malformed_string_raises_value_error(self):
     # Arrange
     # Act
     # Assert
     with pytest.raises(ValueError):
         StrategyId.from_str("BAD_STRING")