Closed kytrinyx closed 7 years ago
TwoferTest.scala throws a compilation error when running sbt test test("no name given") { Twofer.twofer() should be ("One for you, one for me.") } [error] Unspecified value parameter name. [error] Twofer.twofer() should be ("One for you, one for me.") [error] ^ [error] one error found [error] (Test / compileIncremental) Compilation failed
Twofer.twofer() has the name parameter missing. On adding an empty name parameter error is resolved.
test("no name given") { Twofer.twofer(name = "") should be ("One for you, one for me.") }
@amit-rastogi you may want to report that in the scala track repo. You're more likely to find help there because this repo is about the shared test cases, not the scala implementation, and the scala team might not notice the bug report here.
(cc @exercism/scala)
I am not sure if this is the right place to call for help. I am new to Pharo and trying to use exercism.io to practice. However, I failed to import the example code that I downloaded from https://exercism.io/my/solutions/2c59b5cf2508431baae6a5b95c85a720 into Pharo. I checked in the community and came to understand that Pharo is using a file format called Tonel, which is not the one used in Pharo-exercism. In order to work on Pharo track exercises, one must take it into a Pharo image.
Please advise.
As far as I understand the workflow for Pharo, you need to use some prepared Pharo image that does the downloads and submissions for you.
Please refer to the Pharo instructions on the website and open a complete new issue at GitHub.com/exercism/exercism
@NobbZ I found this repo https://github.com/exercism/pharo-smalltalk but if i understand correctly, it is for already experienced Pharo developers to contribute. I could not find instructions for freshers like myself.
You can ask your question how to work with the pharo track there, chances to find someone who can help you are highest there.
Also, have you followed instructions from https://exercism.io/tracks/pharo-smalltalk/installation, which asks you to run some magic invocation to install the exercism plugin into the Pharo IDE?
Hello,
in Python3 once I run the test by typing in pytest two_fer_test.py
in my shell(zsh) the following is shown:
self = <two_fer_test.TwoFerTest testMethod=test_no_name_given>
def test_no_name_given(self):
> self.assertEqual(two_fer(), "One for you, one for me.")
E TypeError: two_fer() missing 1 required positional argument: 'name'
two_fer_test.py:10: TypeError
======================================================================= short test summary info ========================================================================
FAILED two_fer_test.py::TwoFerTest::test_no_name_given - TypeError: two_fer() missing 1 required positional argument: 'name'
I am using pylint as well. It points to:
> self.assertEqual(two_fer(), "One for you, one for me.")
If I add an empty name, thus:
self.assertEqual(two_fer(""), "One for you, one for me.")
it passes - given that I change the conditional statement accordingly in a separate code file named two_fer.py
:
if name == " ":
return "One for you, one for me"
@IliasMariosG This portion of the exercise is intended to teach you about default arguments. Almost certainly, your code is written something like
def two_fer(name):
# implementation here
However, as the error says, this definition type only works if you pass a value which can be bound to the name
parameter. The definition of the problem, however, asks that you define your two_fer
function such that you can call it without a value. That would look more like this:
def two_fer(name = "default"):
# implementation here
With that definition, anytime the caller doesn't provide a value to be bound to name
, it will use the default value "default"
instead. From there, it's pretty easy to get the test to pass.
Incidentally, while it's good that you've done your research to identify the source of the two-fer
exercise, this isn't really the place to ask for help about the python track. Instead, you can create a new issue in exercism/python
.
On a new checkout of this problem and running npm test
I get the below error. I can run npm test
fine on the Hello World exercise, fwiw.
β― npm test
> @exercism/javascript@1.2.0 test /home/elijah/exercism/javascript/two-fer
> jest --no-cache ./*
sh: line 1: jest: command not found
npm ERR! Test failed. See above for more details.
UPDATE: Okay, works fine, I forgot to run npm install
!
I think there is a problem in the Delphi exercise on Git. It seems that the source of twofer.pas file is empty! Dows anyone know something about this?
Fill it with functionality. In the current v2, this is a choice some tracks did.
As of Version 1.2.0, the unit tests for this exercise do not compile.
Compile error: Unspecified value parameters: name: String
The following line is missing en empty string: Twofer.twofer() should be ("One for you, one for me.")
It should be this instead: Twofer.twofer("") should be ("One for you, one for me.")
Hello fellow developers.
I'm a total noob in python but I'm wondering why this code is not valid in your validation testing:
def two_fer(self=''):
if self != '':
return print(f'One for {self}, one for me.')
else:
return print('One for you, one for me.')
Thank you, and sorry in advance if this is not the correct channel to give you feedback regarding exercises.
@axor there is a difference between return
ing a value and print
ing a value. return
is intended to pass the value to the calling function, while print
is intended to print the value to the console. If you remove the print
function and the parentheses it should pass the tests.
Feel free to request mentoring (and if the tests isn't passing you can submit and incomplete solution from the CLI) and someone be able to assist you.
EDIT: issues for python specifically should be in https://github.com/exercism/python
@axor there is a difference between
return
ing a value andreturn
is intended to pass the value to the calling function, whileFeel free to request mentoring (and if the tests isn't passing you can submit and incomplete solution from the CLI) and someone be able to assist you.
EDIT: issues for python specifically should be in https://github.com/exercism/python
!!! Good tip : try to return answer without print function, just compose the answer in combination with strings in parenthesis and the variable
Hello! I'm trying to run the following scala code (which I reckon is correct)
object Twofer {
def twofer(name: String = ""): String = name match {
case "" => "One for you, one for me."
case _ => s"One for $name, one for me."
}
}
but I receive the following error when running the tests:
@saveriogzz you'll get better response by creating an issue in the exercism/exercism repo
def two_fer(name=None): if name is not None: return "One for " + name + ", one for me." else: return "One for you, one for me."
print(two_fer("Alice"))
print(two_fer())
This exercise may be out of order in the golang
exercise listing page. I was surprised by the simplicity of the exercise until I came to this page to notice that it was supposed to be equivalent to hello world.
@adithyabsk Would you report this in the forum? https://forum.exercism.org/ That will ensure that the right people see the discussion.
In mac , using brew I got the following error π
Error: bats has been disabled because it has an archived upstream repository!
So I installed bats-core and it worked.
brew install bats-core
In mac , using brew I got the following error π
Error: bats has been disabled because it has an archived upstream repository!
So I installed bats-core and it worked.
brew install bats-core
That's unrelated to this issue. For support, consider using the forum or Discord.
In #548 we discussed a new exercise which is equivalent to the current
hello-world
exercise (which conditionally provides a name, or defaults to "world") in the string "hello, %s".The conclusion was to implement a new exercise,
two-fer
."One for X, one for me."
where X is either a name, or it defaults to"you"
.Next steps:
hello-world
exercise, suggesting that hello-world be simplified as described in the discussion in https://github.com/exercism/x-common/issues/520blazon
(there's some documentation about how to use blazon in https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/improving-consistency-across-tracks.md, and an open issue about making that a stand-alone and more complete document in https://github.com/exercism/docs/issues/10)