def test_from_serializable_string_given_malformed_string_raises_value_error(self): # Arrange bar = Bar( AUDUSD_1_MIN_BID, Price("1.00001"), Price("1.00004"), Price("1.00002"), Price("1.00003"), Quantity(100000), 0, ) # Act # Assert with pytest.raises(ValueError): bar.from_serializable_str(AUDUSD_1_MIN_BID, "NOT_BAR_VALUES!")
def test_from_serializable_string_given_malformed_string_raises_value_error( self): # Arrange bar = Bar( Price("1.00001"), Price("1.00004"), Price("1.00002"), Price("1.00003"), Quantity(100000), UNIX_EPOCH, ) # Act # Assert with pytest.raises(ValueError): bar.from_serializable_str("NOT_A_BAR")
def test_from_serializable_string_given_valid_string_returns_expected_bar(self): # Arrange bar = TestStubs.bar_5decimal() # Act result = Bar.from_serializable_str(bar.type, bar.to_serializable_str()) # Assert assert result == bar