<s> from django . test import TestCase <EOL> from rest_framework . renderers import JSONRenderer <EOL> from periods import models as period_models <EOL> from periods . serializers import FlowEventSerializer <EOL> from periods . tests . factories import FlowEventFactory <EOL> class TestFlowEventViewSet ( TestCase ) : <EOL> def setUp ( self ) : <EOL> FlowEventFactory ( ) <EOL> self . serializer = FlowEventSerializer ( instance = period_models . FlowEvent . objects . all ( ) [ <NUM_LIT:0> ] ) <EOL> def test_serialization ( self ) : <EOL> result = JSONRenderer ( ) . render ( self . serializer . data ) <EOL> expected = ( b'<STR_LIT>' <EOL> b'<STR_LIT>' ) <EOL> self . assertRegex ( result , expected ) <EOL> def test_validate_clots_no_value ( self ) : <EOL> result = self . serializer . validate_clots ( None ) <EOL> self . assertEqual ( None , result ) <EOL> def test_validate_clots_empty_value ( self ) : <EOL> result = self . serializer . validate_clots ( '<STR_LIT>' ) <EOL> self . assertEqual ( None , result ) <EOL> def test_validate_clots_zero_value ( self ) : <EOL> result = self . serializer . validate_clots ( <NUM_LIT:0> ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> def test_validate_clots_valid_value ( self ) : <EOL> result = self . serializer . validate_clots ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:1> , result ) <EOL> def test_validate_cramps_zero_value ( self ) : <EOL> result = self . serializer . validate_cramps ( <NUM_LIT:0> ) <EOL> self . assertEqual ( <NUM_LIT:0> , result ) <EOL> def test_validate_cramps_valid_value ( self ) : <EOL> result = self . serializer . validate_cramps ( <NUM_LIT:1> ) <EOL> self . assertEqual ( <NUM_LIT:1> , result ) </s>
