Comments (3)
There's no conversion happening. A list of digits that can be represented as a string just happens to be displayed as a string in iex. The list underneath is unchanged:
iex(1)> a = [65, 66, 67]
'ABC'
iex(2)> hd(a)
65
from ex_machina.
well, that's exactly why I created this issue :) Theory said it appears only in IEx, but practice showed chars in my list from ExMachina.sequence/2
Here is an example:
# test/support/data_case.ex
allowed_ids = [id_1 | _] = [next_id(), next_id(), next_id(), next_id()]
# test/support/factory.ex
use ExMachina.Ecto
def next_id, do: sequence(:id, & &1)
# run mix test.watch with dbg(allowed_ids) been added
#test A
subject_info: %Context.SubjectInfo{
user_token: "admin token",
user_id: 389,
allowed_ids: 'STUV',
__unknown_fields__: []
#test B
subject_info: %Context.SubjectInfo{
user_token: "admin token",
user_id: 1000,
allowed_ids: '{|}~',
__unknown_fields__: []
},
#test C
subject_info: %Context.SubjectInfo{
user_token: "admin token",
user_id: 802,
allowed_ids: '\a\b\t\n',
__unknown_fields__: []
},
#test D
subject_info: %Context.SubjectInfo{
user_token: "admin token",
user_id: 31,
allowed_ids: [0, 1, 2, 3],
__unknown_fields__: []
},
It looks like when you are using mix test.watch - it restart setup
and re-generate a context with new allowed_ids. And after 8-10 restarts (test.watch restarts each time you save the file) when next_id's value go over 36, the list of ids goes to charlist instead of digits-only list (between 35-126).
After 126 it goes back to digits-only.
That's why when you try "Enum.member?(allowed_ids, 3)" it fails and said "allowed_ids = 'fghi'"
from ex_machina.
Looks like it was my fault and I made this issue ticket due to my lack of experience. Sorry. Falce alarm
from ex_machina.
Related Issues (20)
- def build/2 defines defaults multiple times HOT 2
- Use of `build( ... )` with Ecto 3.4+ leads to many association preload warnings HOT 7
- Compiler warning when using an a project using Elixir 1.11 HOT 3
- Insert with assocs fails constraint HOT 1
- Proposal: Introduce build_lazy/2 HOT 3
- Test-only implementation fails HOT 4
- Cast polymorphic embeds HOT 10
- Inserted data breaks manual test HOT 3
- Allow sequence in attributes passed to `insert_list` HOT 5
- Hundreds of depreciation compiler warnings when running tests HOT 4
- insert/2 doesn't work with compound primary keys HOT 3
- Allow sequences indices to be persisted between runs HOT 2
- sequence starting with 0
- Is this project maintained? HOT 17
- Sequence reset doesn't respect the `start_at` option
- Stringify `Ecto.Enum` values when using `string_params`/`string_params_with_assocs`
- Option to have `insert_list` leverage Ecto's `insert_all`
- an intermittent error on async false tests HOT 1
- nvim diagnostics error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ex_machina.