File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import unittest
2+
3+ from pyvalueobjects .errors .ValueObjectError import ValueObjectError
4+ from pyvalueobjects .strings .string import String
5+
6+
7+ class TestStringValueObject (unittest .TestCase ):
8+ def test_value_return_input_value (self ):
9+ vo = String ('' )
10+ self .assertEqual ('' , vo .value ())
11+
12+ def test_from_string_method_returns_string (self ):
13+ vo = String .from_int (39 )
14+ self .assertEqual ('39' , vo .value ())
15+
16+ def test_from_float_method_returns_int_format_string (self ):
17+ vo = String .from_float (39.0 )
18+ self .assertEqual ('39.0' , vo .value ())
19+
20+ def test_zero_value_return_input_value (self ):
21+ vo = String .from_int (0 )
22+ self .assertEqual ('0' , vo .value ())
23+
24+ def test_basic_string (self ):
25+ vo = String ('patata' )
26+ self .assertEqual ('patata' , vo .value ())
27+
28+ def test_none_raise_error (self ):
29+ self .assertRaises (ValueObjectError , String , None )
You can’t perform that action at this time.
0 commit comments