omaciel / fauxfactory

Generates random data for your tests.
Other
37 stars 26 forks source link

`Start` Param in string methods. #103

Closed digitronik closed 5 years ago

digitronik commented 5 years ago

Signed-off-by: Nikhil Dhandre nik.digitronik@live.com

fixed #102

codecov[bot] commented 5 years ago

Codecov Report

Merging #103 into master will not change coverage. The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #103   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files           9      9           
  Lines         455    476   +21     
=====================================
+ Hits          455    476   +21
Impacted Files Coverage Δ
fauxfactory/factories/strings.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update df28434...af4f851. Read the comment docs.

omaciel commented 5 years ago

Interesting... at first I interpreted the requirement as being Given a start parameter, string generating methods should yield a string that starts with a string representation of said parameter, which should be counted toward the final length of the final string.

For example:

In [1]: gen_alpha(start="volume") # defaults to 10 characters                                                                                                                 
Out[1]: 'volume_DGD' # 10 total chars

So is it standard to assume that given a method that offers both length and start, that the final string will be of length equals to the sum of length + start and an additional separator character? Should then separator be an optional parameter that defaults to _?

digitronik commented 5 years ago

Interesting... at first I interpreted the requirement as being Given a start parameter, string generating methods should yield a string that starts with a string representation of said parameter, which should be counted toward the final length of the final string.

I agreed with this :+1: . We should to take care of final random data string length.

For example:

In [1]: gen_alpha(start="volume") # defaults to 10 characters                                                                                                                 
Out[1]: 'volume_DGD' # 10 total chars

So is it standard to assume that given a method that offers both length and start, that the final string will be of length equals to the sum of length + start and an additional separator character? Should then separator be an optional parameter that defaults to _?

@omaciel if you ack. As per me separator should optional arg and default value should ''. It should user privilege that they want to add separator or not; even user can add separator as per gen type.

def gen_alpha(length=10, start=None, separator=''):
    pass